Created
April 5, 2012 18:47
-
-
Save jai-o/2313195 to your computer and use it in GitHub Desktop.
Works! Removes Index.php, Force HTTPS, removes www
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
RewriteEngine On | |
# Removes index.php | |
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /index.php/$1 | |
# Depends on your web host and setup, check with your web host specific settings | |
RewriteCond %{ENV:SECURE_REDIRECT} !=on | |
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301] | |
# Make www to non-www | |
RewriteCond %{HTTP_HOST} ^www.example.com [NC] | |
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] | |
Thanks James! That did it!
Note for forcing HTTPS, check with your specific web host as their configuration may require different RewriteCond
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you need the [OR] on line 17? Looks like it's just the one conditional.