I am using following rule of .htaccess to redirect site from http to https.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
But my site code is placed under folder Testversion. So when I add this rule in .htaccess file, my url becomes " https://abcd.com/Testversion " instead of " https://abcd.com "
Any one knows how I can skip Testversion folder name ?
If your .htaccess
is placed inside a subdirectory then you can use:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [R,L]
ie capture relative URI (from current directory) from RewriteRule
and use it in the target.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.