[英]403 Forbidden error from specific htaccess Rewrite
I am using .htaccess
' RewriteRule
to redirect a url to the proper page for a client, everything works fine, except for Rewriting the word catalogue! 我使用
.htaccess
' RewriteRule
重定向的URL将客户正确的页面,一切正常,除了重写字目录! I get a 403 forbidden error. 我收到403禁止错误。
This is my code: 这是我的代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^catalogue$ /catalogue.php
</IfModule>
This results in this: 结果是:
Now, what is driving me crazy is, if i switch the code to RewriteRule ^catalog$ /catalogue.php
or RewriteRule ^cataloguee$ /catalogue.php
and browse to the respective url, the page displays without the error. 现在,让我发疯的是,如果我将代码切换到
RewriteRule ^catalog$ /catalogue.php
或RewriteRule ^cataloguee$ /catalogue.php
并浏览到相应的URL,则显示的页面没有错误。
Any ideas why this is occuring? 任何想法为什么会这样?
It looks like what's happening is some kind of DirectorySlash
functionality is kicking in (adds a trailing slash when it thinks you're trying to access a directory). 好像正在发生某种
DirectorySlash
功能启动(在认为您试图访问目录时添加了斜杠)。 It's probably better not to turn that off so just match against the URI with the trailing slash: 最好不要将其关闭,因此只需将URI与结尾的斜杠匹配即可:
RewriteRule ^catalogue/?$ /catalogue.php [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.