开发者

.htaccess why problem when using ? in Redirect

i have this line

Redirect /?page=cms_page&id=12 http://www.domain.dk/case

when i type ?page=...... its not will work if i only 开发者_JS百科use page=..... its will work fine but not the user type

domain.dk/?page=cms_page&id=12

So now i ask you guys what have i make wrong?


With the directives of mod_alias you can only test for the URI path but not the URI query. To do so, you can use mod_rewrite:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^page=cms_page&id=12$
RewriteRule ^$ http://www.example.com/case? [L,R]

The empty query in the substitution will avoid that the original query will automatically appended to the new URI. And the R flag will force an external redirect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜