www到没有index.php的SSL的非www

时间:2016-02-02 19:20:05

标签: .htaccess rewrite no-www

当我尝试从网址www.mypage.com进入我的网站时,我得到了http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Feditors%2Fmanifest_editor%2Fdependencies.htm ....

当我从url mypage.com进入时,我得到http://www.mypage.com/index.php/https://mypage.com/https://www.mypage.com - 并且确定

当我从url mypage.com/stuff进入时,我得到https://mypage.com(页面工作)

当我从网址www.mypage.com/stuff进入时,我得到https://mypage.com/index.php/stuff

我该怎么办?我想总是像https://mypage.com/index.php/stuff那样没有index.php而没有'www'。

我的.htaccess:

AddHandler application/x-httpd-php70 php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

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

谢谢!

1 个答案:

答案 0 :(得分:3)

尝试切换订单,以便最后执行内部重定向到index.php / $ 1:

AddHandler application/x-httpd-php70 php
RewriteEngine On

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

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

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]