mirror of
https://github.com/kremalicious/blog.git
synced 2025-02-14 21:10:25 +01:00
proper rules to remove www & force SSL without getting redirect loop
This commit is contained in:
parent
4d6c89f5f6
commit
8bf7d0eba0
@ -880,24 +880,24 @@ FileETag None
|
|||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteBase /
|
RewriteBase /
|
||||||
|
|
||||||
RewriteCond %{HTTPS} !=on
|
# throw everything onto https
|
||||||
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
|
RewriteCond %{SERVER_PORT} 80
|
||||||
RewriteRule ^ http://%1%{REQUEST_URI} [R]
|
RewriteRule ^(.*)$ https://www.kremalicious.com/$1 [R,L]
|
||||||
|
|
||||||
|
# and remove wwww
|
||||||
|
RewriteCond %{HTTP_HOST} ^www\.kremalicious\.com [NC]
|
||||||
|
RewriteRule ^(.*)$ https://kremalicious.com/$1 [L,R=301]
|
||||||
|
|
||||||
# redirect all index.html to parent folder
|
# redirect all index.html to parent folder
|
||||||
RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
|
RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
|
||||||
RewriteRule . %1 [R=301,NE,L]
|
RewriteRule . %1 [R=301,NE,L]
|
||||||
|
|
||||||
# RewriteCond %{HTTPS} !=on
|
# Remove date from post permalinks
|
||||||
# RewriteRule ^(.*)$ https://kremalicious.com/$1 [R=301,L]
|
RewriteRule ^([0-9]+)/([0-9]+)/(.*)$ /$3 [R=301,NC,L]
|
||||||
|
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
# Remove date from post permalinks
|
|
||||||
RedirectMatch 301 ^/([0-9]+)/([0-9]+)/(.*)$ /$3
|
|
||||||
|
|
||||||
# Old Content Redirects
|
# Old Content Redirects
|
||||||
|
|
||||||
Redirect 301 /lab http://lab.kremalicious.com
|
Redirect 301 /lab http://lab.kremalicious.com
|
||||||
Redirect 301 /csspaperstack /lab/csspaperstack
|
Redirect 301 /csspaperstack /lab/csspaperstack
|
||||||
Redirect 301 /download /media
|
Redirect 301 /download /media
|
||||||
|
Loading…
Reference in New Issue
Block a user