简体   繁体   English

Apache未完成https的index.php

[英]Apache doesn't complete index.php for https

When entering eg http:// mysite, the server returns https:// mysite/index.php - this is correct behavior But when starting with https right away: eg https:// mysite, the server returns only https:// mysite/ (without the index.php). 输入例如http:// mysite时,服务器返回https:// mysite / index.php-这是正确的行为,但是当立即以https开头时:例如https:// mysite,服务器仅返回https:// mysite /(没有index.php)。 The site loads however ok. 该站点加载正常。 The problem causes some incorrect behavior on the application itself. 该问题导致应用程序本身出现某些不正确的行为。 So I would like to get it including the index.php also when asking for https:// too. 所以我也想在请求https://时也包括index.php。

This is the httpd conf file: 这是httpd conf文件:

# forbid access to the entire filesystem by default
<Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory /srv/installateur/content/approot/>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !index.php
    RewriteRule !\.(js|ico|gif|jpg|png|css|swf|pdf|html|csv)$ /index.php [L] 
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    Options Indexes MultiViews SymLinksIfOwnerMatch
    AllowOverride all
    Order allow,deny
    Allow from all
</Directory>

# use .htaccess files for overriding,
AccessFileName .htaccess
# and never show them
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

# List of resources to look for when the client requests a directory
DirectoryIndex index.php

thanks for any help! 谢谢你的帮助!

You shouldn't rewrite like that. 您不应该这样重写。 Instead, do two virtual hosts, one for http and the other for https and use 301 redirect from http to https while keeping request params. 而是,做两个虚拟主机,一个虚拟主机用于http,另一个虚拟主机用于https,并使用301从http重定向到https,同时保留请求参数。

Official Apache mod_rewrite documentation See section "Simple Redirection" 官方Apache mod_rewrite文档,请参见“简单重定向”部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM