.htaccess 使用https时,页面将被删除://
我刚刚在我的服务器上安装了一个SSL,并在我的网站管理区启用了https,但是现在当使用https://而不是http://访问正常页面时,我会得到一个404页面。这是我的htaccess,其中也删除了标准的expressionengine index.php,但如果使用它访问前端页面,我无法确定需要做哪些更改才能使https://正常工作,有什么想法吗?:.htaccess 使用https时,页面将被删除://,.htaccess,ssl,https,.htaccess,Ssl,Https,我刚刚在我的服务器上安装了一个SSL,并在我的网站管理区启用了https,但是现在当使用https://而不是http://访问正常页面时,我会得到一个404页面。这是我的htaccess,其中也删除了标准的expressionengine index.php,但如果使用它访问前端页面,我无法确定需要做哪些更改才能使https://正常工作,有什么想法吗?: <IfModule mod_rewrite.c> RewriteEngine On # fo
<IfModule mod_rewrite.c>
RewriteEngine On
# force https for all URLs in /admin.php
RewriteCond %{HTTPS} =off
RewriteRule ^admin.php https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Redirect index.php Requests
# ------------------------------
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{THE_REQUEST} !/system/.*
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]
# Standard ExpressionEngine Rewrite
# ------------------------------
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
重新启动发动机
#对/admin.php中的所有URL强制使用https
RewriteCond%{HTTPS}=off
重写规则^admin.php https://%{HTTP_HOST}%{REQUEST_URI}[R=301,L]
#重定向index.php请求
# ------------------------------
RewriteCond%{THE_REQUEST}^GET.*index\.php[NC]
重写cond%{THE_REQUEST}/系统/*
重写规则(.*)索引\.php/*(.*)/$1$2[R=301,L]
#标准表达式引擎重写
# ------------------------------
重写秒$1!\。(css | js | gif | jpe?g | png)[NC]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/index.php/$1[L]
用以下代码替换所有代码:
RewriteEngine On
# force https for all URLs in /admin.php
RewriteCond %{HTTPS} off
RewriteRule ^admin\.php https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{REQUEST_URI} !/system/ [NC]
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
你能为
https
站点显示你的VirtualHost
配置吗?不幸的是,我们不能,因为我们在一个共享主机上,该主机不允许我们访问此站点,我请求该主机将此信息发送给我们!现在缩小范围,似乎与index.php重写有关,如果我去做它不起作用,但如果我去做它起作用,你知道如何让index.php重写同时适用于http和https吗?谢谢Anubhava,不幸的是,这只会导致完全相同的问题,但我们的htaccess中的代码要少得多!我怀疑您的https
请求甚至没有命中此.htaccess(由于VirtualHost
中的DocumentRoot
不同)。要测试这一点,请在.htaccess
上放置相同的垃圾(随机)文本,然后打开https://domain.com/index.php/page
看看它是否会生成500(内部服务器)错误?看起来是这样的,谢谢,我会更新virtualhost设置!不客气,这就是我首先评论VirtualHost
设置的原因。