Forum Moderators: phranque
This is what I have so far:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#Redirect to canonical domain
RewriteCond %{HTTP_HOST} ^www\.example.com [NC]
RewriteRule (.*) http://example.com$1 [R=301,L]
# WP premlinks
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
It works, but if I request a directory from www. it removes the "/"
If I request www.example.com/directory I get www.example.comdirectory
Thanks for any help
RewriteCond %{HTTP_HOST} ^www\.example.com [NC]
should be
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
However, this will work just as well (it means "starts with www."):
RewriteCond %{HTTP_HOST} ^www\. [NC]
This line:
RewriteRule (.*) http://example.com$1 [R=301,L]
should be
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
Sorry I don't know enough to comment on the remaining block:
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule . /index.php [L]