2016-10-09 39 views
-1

我試着去我的網址路徑更改來自:如何更改url路徑並擁有http:// instad of http?

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] 

回答

0

我不能評論你牛逼,所以我問在這裏:

你的問題/需求將最終服務於2 dommain與www和域的請求W/O WWW:

example.com/path/index.php 

http://example.com/path/index.php 

https://example.com/ 

哪些回到着陸頁---沒有重新定義到www.example.com,是這樣嗎?

www.example.com/path/index.php 

http://www.example.com/path/index.php 

https://www.example.com/path/index.php 

簡單地強制使用HTTPS啓用?

如果是真的,那麼下面

RewriteCond %{HTTP_HOST} !^www\. 
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] 

你的代碼添加到WWW主機並沒有涉及到您發佈的需求/問題。你能否讓你的問題更清楚?

+0

我爲此道歉,是的。我正在這樣做,所以它將所有內容重定向到www。並且我粘貼了錯誤的代碼(www。版本),這並不重要。我的主要觀點是強制https並更改url路徑/提示頁面。 – ErroR