My site url was originally like this: http://www.example.com/folder
I'm trying to get rid of www and /folder, as well as redirecting http to https. My .htaccess currently looks like this:
RewriteCond %{HTTPS} =off [OR]
RewriteCond %{HTTP_HOST} !^example\.com/folder$
RewriteRule ^(.*)$ "https://example.com/$1" [R=301,L]
http://www.example.com/folder/mypage should then redirect to https://example.com/mypage but I have no idea how to remove /folder. Any help will be greatly appreciated.
要删除目录,您需要这样一行:
RewriteRule ^folder/(.*)$ /$1 [L,R=301]
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.