2013-04-09 93 views
-1

我如何使用htacces從重定向:http://www.example.com/directory/wp-login.php?action=register 到:http://www.example.com/sitemap.html的.htaccess重定向

回答

1

你需要使用一個重寫條件匹配對%{QUERY_STRING}變量(這是action=register在你的例子),然後對陣重寫規則中的URI(在您的示例中爲directory/wp-login.php)。所以它非常簡單。

RewriteEngine On 
RewriteCond %{QUERY_STRING} ^action=register(&|$) 
RewriteRule ^directory/wp-login\.php$ /sitemap.html? [L,R=301] 

這些都將在你的文檔根htaccess的文件,最好之前,你可能已經在那裏的任何規則。