Apache 简单url重写

Apache 简单url重写,apache,mod-rewrite,Apache,Mod Rewrite,如果url包含某个变量,如何添加到.htaccess文件中,使以下规则不适用 # Options All # Options -Indexes # # RewriteEngine on # # RewriteCond %{HTTP_REFERER} !^$ # RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC] # RewriteRule (.*)$ /shared/php/v1/hotmusiclink.php?p

如果url包含某个变量,如何添加到.htaccess文件中,使以下规则不适用

# 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.除非url中有字符串?code=s0mec0de,否则上述url应将所有url重定向到hotmusiclink.php


谢谢:)

您可以使用RewriteCond使任何给定的重写不被应用

RewriteCond %{QUERY_STRING} !code=s0mec0de
RewriteRule ^.*$ /hotmusiclink.php
玩到它起作用为止