Search This Blog

Friday, December 17, 2010

Solving Canonical Url's and hide index.php

Following code redirects non www. url's to www. url's. Good for CEO and firefox font-face loading bug.

Options +FollowSymLinks

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.php\ HTTP/
RewriteRule ^(([^/]+/)*)index\.php$  http://www.domain.com/$1 [R=301,L]

No comments:

Post a Comment