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...
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.htmRewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
I can't show an example right now as I removed the edit to my htaccess file!
Any ideas? Thanks for any help!
Last edited by frankp; 15-03-2007 at 03:38 AM.
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]
It *might* help if you put all the rules into one block.
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:
it seems.RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
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