Apache 使用https时通过.htaccess重定向*到索引

Apache 使用https时通过.htaccess重定向*到索引,apache,.htaccess,Apache,.htaccess,我有一个简单的.htaccess文件,它将所有不存在的文件重定向到index.php 当我通过HTTP访问我的网站时,它工作得很好。但是当我尝试使用HTTPS时 重定向不起作用。以下是.htaccess内容: RewriteEngine on RewriteBase / php_flag display_errors on php_value error_reporting 7 RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.

我有一个简单的.htaccess文件,它将所有不存在的文件重定向到index.php 当我通过HTTP访问我的网站时,它工作得很好。但是当我尝试使用HTTPS时 重定向不起作用。以下是.htaccess内容:

RewriteEngine on
RewriteBase /

php_flag display_errors on
php_value error_reporting 7

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

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /var/www/index.php [NC,L,QSA]

另外,我需要保留HTTP和HTTPS选项。

什么是Apache配置中HTTPS VirtualHost的DocumentRoot?我在/etc/apache2/apache2.confok中没有看到类似的内容。请进一步澄清,到底是什么不起作用?当你进入时会发生什么http://www.domain.com/?It 将重定向到并确认。如果你打开它将打开主页,这就是我需要友好的网址。但是当我通过HTTPS打开同一个不存在的路径时,它返回文件不存在https://domain.com/foo-bar 显示404?如果是,则需要从服务器管理员处查找https站点的DocumentRoot值。