[英].htaccess rewrite where url basename is same as a directory name
我的文件结构中有一个名为“ finder”的目录,我想重写一个以finder为基本名的URL。 例如,访问www.mysite.com/finder
。
这是我正在尝试的重写规则:
RewriteRule ^finder/?$ /finder/directory/listings.php [NC,L]
而不是成功重写,我收到了404 Page Not Found消息。 对于我值得的是,我有一个重写规则,该规则将这个URL用作该网址www.mysite.com/finder/california
...
RewriteRule ^finder/([a-zA-Z0-9+\-]*)/?$ /finder/directory/listings.php?s=$1 [NC,L]
..并且它正在工作。
我已经尝试过将DirectorySlash Off
为我的.htaccess文件,但这也不起作用。 关于我所缺少的任何线索吗? 谢谢。
我看到两个潜在的麻烦领域:
finder
文件夹中。 确保它在DOCUMENT_ROOT
目录中。 在Apache 2.2和2.4上测试:
RewriteRule ^finder/?$ directory/listings.php [NC,L]
http://www.example.com/finder
: http://www.example.com/finder
http://www.example.com/directory/listings.php
: http://www.example.com/directory/listings.php
让我知道这个是否奏效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.