.htaccess 考虑到现有规则,HTACCESS重写为HTTPS
我正在强制命名索引文件的请求删除索引文件名,并在此处强制非www:.htaccess 考虑到现有规则,HTACCESS重写为HTTPS,.htaccess,mod-rewrite,redirect,.htaccess,Mod Rewrite,Redirect,我正在强制命名索引文件的请求删除索引文件名,并在此处强制非www: RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?|php)(\?[^\ ]*)?\ HTTP/ RewriteRule ^(([^/]*/)*)index\.(html?|php)$ http://techsupportheroes.com/$1 [R=301,L] 但我需要将所有请求重定向到 这不是我的专长领域。寻找一个优雅的解决方案,如果
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?|php)(\?[^\ ]*)?\ HTTP/
RewriteRule ^(([^/]*/)*)index\.(html?|php)$ http://techsupportheroes.com/$1 [R=301,L]
但我需要将所有请求重定向到
这不是我的专长领域。寻找一个优雅的解决方案,如果有人有时间
谢谢,
Eric尝试以下代码:
RewriteEngine On
# remove www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://$1%{REQUEST_URI} [R=301,NE,L]
# remove index.html
RewriteCond %{THE_REQUEST} /index\.(html?|php) [NC]
RewriteRule ^(([^/]*/)*)index\.(html?|php)$ http://techsupportheroes.com/$1 [NC,R=301,L]
#force https for /cart/index.php
RewriteCond %{HTTPS} off
RewriteRule ^(cart)/index\.php$ https://%{HTTP_HOST}/$1/ [R=301,L,NC]
“我需要将所有请求重定向到
到
"
试试这个:
RewriteEngine On
#not https
RewriteCond %{HTTPS} off
RewriteRule /cart/index.php https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]