Last active
July 30, 2019 14:28
-
-
Save JasvinderSingh1/0db75937185090cb25063c11db51deef to your computer and use it in GitHub Desktop.
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
How to redirect http://domain.com to https://www.domain.com? | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
********************* | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
RewriteCond %{HTTP_HOST} !^www\. [NC] | |
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule . /index.php [L] | |
</IfModule> | |
**** To remove .php from URL start **** | |
RewriteEngine On | |
RewriteBase /admin/ | |
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC] | |
RewriteRule ^ %1 [R=301,L] | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteCond %{REQUEST_FILENAME}.php -f | |
RewriteRule ^(.*?)/?$ $1.php [NC,L] | |
-> Be sure to change the "RewriteBase", write "/" if you are putting it in root | |
**** To remove .php from URL end **** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment