Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite not recursing through directories?

works in path root but not sub-folders

         

amznVibe

7:14 pm on May 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I feel really stupid on this one but for the life of me I can't figure it out.

I'm using some standard htaccess rewrite code to remove www. from URLs.

Works great on www.example.com/filename.htm

Does not do anything on www.example.com/blog/

Never experienced this before, is there some kind of directive that could be interfering?

I probably should mention the subfolder is wordpress
but we are just talking the wordpress base, not any virtual directories.

it's own htaccess just has the standard

RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /blog/index.php [L]

That wouldn't interfere would it?

amznVibe

7:47 pm on May 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



After much more googling I found for some strange reason both the www. removal and the wordpress directives have to be in the same top htacces, they cannot nest so this is one answer


RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]

RewriteCond %{REQUEST_URI} ^/?blog.* [NC]
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /blog/index.php [L]

problem solved!

g1smd

10:05 pm on May 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Does any of this code result in a redirection chain for any requested URLs?

If it does then that is not good.

.

Special cases should go first and should also force the domain for those special cases.