简单的 url 重写
如何添加到 .htaccess 文件,以便在 url 包含某个变量时以下规则不适用?
# Options All
# Options -Indexes
#
# RewriteEngine on
#
# RewriteCond %{HTTP_REFERER} !^$
# RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC]
# RewriteRule (.*)$ /shared/php/v1/hotmusiclink.php?p=$1 [L]
# AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI
例如,上面的内容应该将所有 url 重定向到 hotmusiclink.php,除非它们的 url 中有字符串 ?code=s0mec0de
谢谢:)
How can i add to a .htaccess file so that the following rules don't apply if the url contains a certain variable?
# Options All
# Options -Indexes
#
# RewriteEngine on
#
# RewriteCond %{HTTP_REFERER} !^$
# RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC]
# RewriteRule (.*)$ /shared/php/v1/hotmusiclink.php?p=$1 [L]
# AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI
e.g. the above should redirect all url's to hotmusiclink.php, unless they have the string ?code=s0mec0de in the url
thanks :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用RewriteCond来使任何给定的重写不被应用。
一直玩到它起作用为止。
You can use RewriteCond to make any given rewrite not be applied.
Play with that until it works.