【发布时间】:2017-05-03 16:46:16
【问题描述】:
我最近发现了一个错误,当我转到 example.com/phpmyadmin 或 example.com/index 时,尾部的斜杠会被删除,所以它会调用 example.comphpadmin 或 example.comindex。斜线之后的所有内容都会发生这种情况。但是如果我有第二个斜杠,比如example.com/index/home,它就可以完美地工作。
我的站点配置中有一个从 http 到 https 的重定向活动,运行 apache2.4。
我的配置:
<VirtualHost *:80>
ServerName example.net
Redirect permanent / https://example.net
</VirtualHost>
还有我的 .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
# slashes.
# If your page resides at
# http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(phpmyadmin|index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
我环顾四周,但没有找到答案。也许我的配置有问题,有人可以帮助我。
【问题讨论】:
-
请不要通过回滚我们的改进来破坏您的帖子。
-
好吧,对不起,我是整个网站的新手,并没有完全看到你对它做了什么,我以为你删除了一些文本,但我看到你把它改成了代码.谢谢
标签: .htaccess apache2.4 trailing-slash