ale*_*lex 12 apache .htaccess mod-rewrite
我正在重定向所有请求,如下所示:
RewriteRule ^sitemap.xml$ sitemap.php?/ [QSA,L]
# the line below is the one I'm having trouble with
RewriteCond %{REQUEST_URI} !^market-reports$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php?section=$1 [QSA,L]
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我所有的传入链接都是指index.php.但现在我想阻止一个人去那里.我以前从来没有自己写过RewriteCond,所以我有点不确定我所做的是否正确.
基本上我想说的是:"如果传入的URL是文件,目录或/ market-reports /什么都不做.否则将URL发送到index.php?section ="
我究竟做错了什么?谢谢
Owe*_*wen 21
所以你只需要忽略http://yourdomain.com/market-reports(除了文件/目录?).你应该没问题:
RewriteCond %{REQUEST_URI} !^/market-reports/?$
Run Code Online (Sandbox Code Playgroud)
这将(不)匹配" http://yourdomain.com/market-reports "以及" http://yourdomain.com/market-reports/ "
| 归档时间: |
|
| 查看次数: |
30695 次 |
| 最近记录: |