2010-11-18 160 views
0

如何添加到.htaccess文件,以便下列规则不适用如果URL包含某个变量?简单的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,除非他们有字符串?代码= s0mec0de在URL

谢谢:)

回答

1

您可以使用的RewriteCond使不适用任何给定的重写。

RewriteCond %{QUERY_STRING} !code=s0mec0de 
RewriteRule ^.*$ /hotmusiclink.php 

玩起来,直到它的工作。