0

我强制对命名索引文件的请求删除索引文件文件名,并在此处强制非 www:

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?|php)(\?[^\ ]*)?\ HTTP/ 
RewriteRule ^(([^/]*/)*)index\.(html?|php)$  http://techsupportheroes.com/$1  [R=301,L] 

但我需要将所有请求重定向到http://techsupportheroes.com/cart/index.phphttps://techsupportheroes.com/cart/index.php

这不是我的专业领域。如果有人有时间,正在寻找一个优雅的解决方案。

谢谢,埃里克

4

2 回答 2

0

试试这个代码:

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]
于 2013-10-19T18:10:43.940 回答
0

“我需要将所有请求重定向到 http://techsupportheroes.com/cart/index.phphttps://techsupportheroes.com/cart/index.php

尝试这个:

RewriteEngine On
#not https
RewriteCond %{HTTPS} off
RewriteRule /cart/index.php https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
于 2013-10-19T18:10:47.453 回答