Created
May 6, 2011 03:41
-
-
Save stith/958409 to your computer and use it in GitHub Desktop.
The ultimate Magento SEO .htaccess rewrite rule set
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Grab the protocol being used | |
RewriteCond %{HTTPS} =on | |
RewriteRule ^(.+)$ - [env=ps:https] | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^(.+)$ - [env=ps:http] | |
# Force WWW | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule ^(.*)$ %{ENV:ps}://www.%{HTTP_HOST}/$1 [R=301,L] | |
# Remove index.php from URLs | |
RewriteCond %{REQUEST_URI} ^/index.php/? | |
RewriteRule ^index.php/?(.*)$ %{ENV:ps}://%{HTTP_HOST}/$1 [R=301,L] | |
# Force trailing slashes | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_URI} !.html | |
RewriteCond %{REQUEST_URI} !(.*)/$ | |
RewriteRule ^(.*)$ %{ENV:ps}://%{HTTP_HOST}/$1/ [R=301,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment