For redirecting the HTTP site to HTTPS, we do following changes to httpd.conf file,
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://abc.com/$1 [R,L]
RewriteCond %{REQUEST_METHOD} ^OPTIONS
RewriteRule .* . [F]
</IfModule>
This setting can cause double slash in the end of the website url.
To exclude the double slash, write "/" in place of "(.*)" as shown below,
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule / https://abc.com/$1 [R,L]
RewriteCond %{REQUEST_METHOD} ^OPTIONS
RewriteRule .* . [F]
</IfModule>
No comments:
Post a Comment