【发布时间】:2017-02-17 22:56:08
【问题描述】:
我正在尝试更改我的 url 路径:
example.com/path/index.php
或
http://example.com/path/index.php
到
https://example.com/
-
从
www.example.com/path/index.php
或
http://www.example.com/path/index.php
到
https://www.example.com/path/index.php
这是我目前所拥有的,它适用于 https:// 部分,但不适用于更改我的 url 路径
.htaccess 文件
#First rewrite any request to the wrong domain to use the correct one (here www.)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#Now, rewrite to HTTPS:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#Change to / instead of /path/index.php (Doesn't work.)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ path/index.php?/$1 [L]
【问题讨论】:
标签: .htaccess url https url-rewriting