Last active
February 1, 2020 14:18
-
-
Save Shumaher/a4b8a064a023e56afea9bc359223e48d to your computer and use it in GitHub Desktop.
mod_rewrite redirects for SEO, see http://blog.alexz.me/seo-redirects for more info
This file contains hidden or 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
# https: | |
RewriteCond %{HTTPS} off | |
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R=301,L] | |
# /? to / | |
RewriteCond %{THE_REQUEST} ^[^\s]+\s+[^?]*?\? | |
RewriteCond %{QUERY_STRING} ="" | |
RewriteRule .? %{REQUEST_URI}? [R=301,L] | |
# index* to / | |
RewriteRule ^index((\.html?)|/?)?$ / [NC,R=301,L] | |
# home* to / | |
RewriteRule ^home((\.html?)/?|(\.php)/?)?$ / [NC,R=301,L] | |
# * to / | |
RewriteRule ^.*\*.*$ / [NC,R=301,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment