Hi,
I have htaccess setup for pretty perma links and would lika to add code to redirect from http://www.domain.com to domain.com. How do I combine those rules?
pretty perma links:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
redirect:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
Thanks, Bo
terriann
Member
Posted 3 years ago #
You should be able to use
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Does that work for you?
Thanks terriann,
As far as I can see it seems to work as it should.
After some more reading I found the post below that says the URL settings under “general options” works the same way as a 301 in htaccess. So for now I'm running both ways.
http://wordpress.org/support/topic/156533?replies=7