no-www htaccess issue

Status
Not open for further replies.

frankp

New Member
I wanted to get rid of the www on my site as per no-www.org so I implemented the code in the htaccess file as they advocate...

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
However I ran into a problem - if someone tries to go to www.domain.com/somepage.htm for example they get sent to domain.com rather than domain.com/somepage.htm

I can't show an example right now as I removed the edit to my htaccess file!

Any ideas? Thanks for any help!


 

frankp

New Member
Sure - and now that I look at it I'm guessing there's a conflict with the Wordpress stuff.. but I've no idea how one would sort it out... any/all help gratefully accepted!


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

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

frankp

New Member
Thanks!

thank you - you're spot on.

and to make matters worse - if I had added wordpress to my search I would have found this thread...

The no-ww code has to come BEFORE the lines:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

it seems.

Currently working htaccess:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.bifsniff\.com$ [NC]
RewriteRule ^(.*)$ http://bifsniff.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress
 
Status
Not open for further replies.
Top