Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Mod rewrite except for one directory

3:44 pm on Apr 9, 2009 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 7, 2003
posts: 539
votes: 0

I'm using mod_rewrite to redirect non-www requests to the www URL, as below:

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

However, after installing Wordpress I find it is caught in a redirect loop because of this. SO how can I exclude the /wordpress directory from the rewrite conditions above?

[edited by: jdMorgan at 4:21 pm (utc) on April 9, 2009]
[edit reason] No URLs. Please see Terms of Service. [/edit]

4:24 pm on Apr 9, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
votes: 0

That's the wrong question to be asking. The correct question --I suspect-- is "Why is my WordPress install forcing requests to "example.com" instead of "www.example.com" and interacting with my RewriteRule to create a loop.

I don't use WP, but I suspect a simple WP configuration error: example.com was specified when www.example.com should have been used.


4:34 pm on Apr 9, 2009 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 7, 2003
votes: 0

Good point, I'll check the WP config.

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members