與mod_rewrite的重定向我現在htaccess
看起來像網址查詢(GET參數樣?ID = 5)htaccess的
DirectoryIndex welcome.do index.jsp default.php index.wml homepage.php default.htm default.html index.php index.php4 index.php3 index.htm index.html index.shtml default_new_vhost.html
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
RedirectPermanent /content.asp?AUID=01 /content/
...
重定向不起作用(我只得到了404頁的WordPress)。原因是URL中的get參數。我試着回答here。例如。
RewriteCond %{REQUEST_URI} ^/content.asp$
RewriteCond %{QUERY_STRING} ^AUID=01$
RewriteRule ^.*$ http://www.yourdomain.com/content? [L,R=301]
要麼我得到500錯誤,要麼我來到Wordpress的404頁面。這樣做的正確方法是什麼?比我在的形式
RedirectPermanent /content.asp?pCategory=&pCountry=1&AUID=01 /content/
這是不對的許多項目,但我尋找一個有效的方式把這個在htaccess的。我可以使用這樣的東西嗎?
RewriteCond %{REQUEST_URI} ^/content.asp$
RewriteCond %{QUERY_STRING} ^pCategory=([0-9]+)&pCountry=([0-6]+)$
RewriteRule ^.*$ http://www.yourdomain.com/content? [L,R=301]
感謝您的建議。不知道這是可能的。 – testing