2010-11-18 159 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 

玩起來,直到它的工作。