Hello, I have a mod_rewrite rule in my .htaccess file. It makes index.php?cat=this&page=that into mysite.com/this/that/. Now, I also have some blogs, which are located at mysite.com/blogs/INSERTNAMEHERE/. Because this is the same pattern as my mod_rewrite, it picks up the index.php, but /blogs/INSERTNAMEHERE/ is a real directory. Is there any page I can make Apache ignore /blogs/insertnamehere/ and display the actual contents in the directory (and NOT use mod_rewrite)? Here are my rewrite rules if this helps any: Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_URI}\\/%{HTTP_HOST}/www.//s%{HTTPS} ^/+(.+/)?[^.]*[^/]\\(/)([^w][^w][^w][^.].*/(www\.)|.*)//((s)on|s.*)$ [OR,NC] RewriteCond %{HTTP_HOST}/www.//s%{HTTPS} ^(/)?(/)?([^w][^w][^w][^.].*/(www\.))//((s)on|s.*)$ [NC] RewriteRule ^ http%6://%4%{HTTP_HOST}%{REQUEST_URI}%2 [L,R=301] RewriteRule ^(.*)/(.*)/ index.php?cat=$1&page=$2 Code (markup): I just discovered that I can't load images either because it's in the form of mysite.com/images/this/that.gif or whatever. UGH! There must be a simple fix, I'm just not very good with mod_rewrite Oh and, yes I do know that I'm misusing the atom Thanks in advanced
Change RewriteRule ^(.*)/(.*)/ index.php?cat=$1&page=$2 Code (markup): to for example RewriteRule ^blog/(.*)/(.*)/$ index.php?cat=$1&page=$2 [L] Code (markup):
Thanks very much. This has fixed my images problem. I now can pull up images and such. However, I still cannot access my blogs at mysite.com/blogs/INSERTNAMEHERE/. Mod_rewrite is still treating it as a category and page name. Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_URI}\\/%{HTTP_HOST}/www.//s%{HTTPS} ^/+(.+/)?[^.]*[^/]\\(/)([^w][^w][^w][^.].*/(www\.)|.*)//((s)on|s.*)$ [OR,NC] RewriteCond %{HTTP_HOST}/www.//s%{HTTPS} ^(/)?(/)?([^w][^w][^w][^.].*/(www\.))//((s)on|s.*)$ [NC] RewriteRule ^ http%6://%4%{HTTP_HOST}%{REQUEST_URI}%2 [L,R=301] RewriteRule ^(.*)/(.*)/$ index.php?cat=$1&page=$2 [L] Code (markup): That's my code now.
Is RewriteRule ^(.*)/(.*)/$ index.php?cat=$1&page=$2 [L] still in the code? That would mess it up. You have to have something unique in the fake URLs to keep from messing with real directories/directories. Just changing it to directory/file.html would fix it, if you don't want a third 'directory' and don't have real .html files there. What are the RewriteCond lines and first RewriteRule line for? And change RewriteEngine on to RewriteEngine on RewriteBase /
Somebody said this to me: However, I dont really know what he's talking about. I dont mean to be a complete n00b, although I am to this, I would appreciate your comments. My code is as follows: Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_URI}\\/%{HTTP_HOST}/www.//s%{HTTPS} ^/+(.+/)?[^.]*[^/]\\(/)([^w][^w][^w][^.].*/(www\.)|.*)//((s)on|s.*)$ [OR,NC] RewriteCond %{HTTP_HOST}/www.//s%{HTTPS} ^(/)?(/)?([^w][^w][^w][^.].*/(www\.))//((s)on|s.*)$ [NC] RewriteRule ^ http%6://%4%{HTTP_HOST}%{REQUEST_URI}%2 [L,R=301] RewriteCond %{REQUEST_URI} !-f RewriteCond %{REQUEST_URI} !-d RewriteRule ^(.*)/(.*)/$ index.php?cat=$1&page=$2 [L] Code (markup): mysite.com/blogs/insertname/ is still not accessible.
If you're only trying to change the URLs... Options +Indexes Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^([^.]+)/([^.]+)$ index.php?cat=$1&page=$2 [L] Except your real blog .com/directoirs/directories/ will be messed up as long as you don't have the last line be something like RewriteRule ^(.*)/(.*)\.html$ index.php?cat=$1&page=$2 [L] to make the URLs different from real URLs, as for example domain.com/directory/file.html.