View Single Post
Old 10-09-2012, 09:19 PM   PM User | #1
strom73
New to the CF scene

 
Join Date: Oct 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
strom73 is an unknown quantity at this point
Mod_rewrite + direct www to non-www not working together

Hello,

I have mod_rewrite enabled on my forum. The code looks like this in .htaccess:

Code:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} .*\.(jpeg|jpg|gif|png)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /public/404.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Now, I want to redirect WWW to non-www with this code:

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST}  ^www.myforum.eu [nocase]
RewriteRule ^(.*)         http://myforum.eu/$1 [last,redirect=301]
When I add the code to the end of the file, it starts to redirect www.myforum.eu/page1.html to the index.php file because of the "RewriteRule . /index.php. How could I get both www to non-www and mod_rewrite SEO friendly URL's working?
strom73 is offline   Reply With Quote