Created
October 16, 2019 11:59
-
-
Save bepatrickdavid/c353e63f4e40d5af6852f3cb7eb47221 to your computer and use it in GitHub Desktop.
Revisions
-
bepatrickdavid created this gist
Oct 16, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # redirect to subfolder /it if language is it RewriteCond %{HTTP:Accept-Language} ^it [NC] RewriteRule ^/?$ https://domain.com/it/ [R,NC,L] # remove the .html extension RewriteCond %{THE_REQUEST} ^GET\ (.*)\.html\ HTTP RewriteRule (.*)\.html$ $1 [R=301] # remove index and reference the directory RewriteRule (.*)/index$ $1/ [R=301] # remove trailing slash if not a directory RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} /$ RewriteRule (.*)/ $1 [R=301] # forward request to html file, **but don't redirect (bot friendly)** RewriteCond %{REQUEST_FILENAME}.html -f RewriteCond %{REQUEST_URI} !/$ RewriteRule (.*) $1\.html [L] # redirect http to https set on the server panel (cpanel/plesk) </IfModule>