在我的网站.htaccess
文件中,我有:
Redirect 301 /?page_id=2276 http://www.orsgroup.com.au/community-newspaper/
当我加载http://www.orsgroup.com.au/?page_id=2276时,它根本不会重定向。
我不明白为什么。你能吗?
更新:我现在意识到您无法使用上述查询字符串重定向网址。
我将以下内容添加到.htaccess
文件中:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/?page_id$
RewriteCond %{QUERY_STRING} ^2276$
RewriteRule ^(.*)$ http://www.orsgroup.com.au/community-newspaper/ [R=301,L]
</IfModule>
但页面http://www.orsgroup.com.au/?page_id=2276未使用此更新进行重定向。
更新2:我已尝试过:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^?page_id=2276$
RewriteRule ^(.*)$ http://www.orsgroup.com.au/community-newspaper/ [R=301,L]
</IfModule>
但是这会重定向到http://www.orsgroup.com.au/community-newspaper/?page_id=2276
答案 0 :(得分:0)
试试这个:
RewriteEngine on
RewriteCond %{THE_REQUEST} /\?page_id=2276 [NC]
RewriteRule ^ http://www.orsgroup.com.au/community-newspaper/? [L,R]
或者这个:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^page_id=2276$ [NC]
RewriteRule ^ http://www.orsgroup.com.au/community-newspaper/? [L,R]