She*_*Gee 10 mod-rewrite .htaccess apache-2.2
我有一个简单的 .htaccess 文件,它在网站的 http 版本上运行良好,但在我转到 https 时却没有。为什么?
RewriteEngine on
#This is so if the file exists then use the file
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ %{REQUEST_FILENAME} [L]
#These conditions check if a file or folder exists just for reference
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#if someone adds ".php" to the slug get rid of it
RewriteRule ^(.*)\.php$ $1
#don't add the [R] here because we don't want it to redirect
RewriteRule ^(.*)$ index.php?id=$1 [L,QSA]
Run Code Online (Sandbox Code Playgroud)
小智 20
这里没有 100% 足够的信息可以继续,但是在通常的默认 SSL 设置(例如 Red Hat/CentOS/Fedora)中,用于 SSL 的 VirtualHost 是在它自己的容器中设置的。使用 mod_rewrite 至少需要在文档根目录上设置“AllowOverride FileInfo”才能起作用。
检查您的 SSL 配置(默认为 /etc/httpd/conf.d/ssl.conf),确保它看起来像:
DocumentRoot /var/www/html
<Directory /var/www/html>
AllowOverride FileInfo
</Directory>
Run Code Online (Sandbox Code Playgroud)
AllowOverride 的默认值是“None”,因此添加 FileInfo 功能的任何其他设置(例如“All”)都可以。
http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride
| 归档时间: |
|
| 查看次数: |
19630 次 |
| 最近记录: |