本文介绍了htaccess的301重定向与查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个htaccess重定向与查询就像这样:

 重定向301 /?页=服务/ branddevelopment /品牌的发展?

或本

 的RewriteCond%{QUERY_STRING} ^页=服务/ branddevelopment $
(。*)重写规则^ $的http://域名/ [R = 301,L]

我失去了在这里的东西吗?或错误的语法?它不重定向我希望它的方式。谢谢!


解决方案

You really didn't explain much about what is happening and the result you are getting so that someone can tell why you are getting the result you are getting.

However in general you can't use mod_alias (Redirect) to redirect a query string it won't work.

You have to use mod_rewrite, which it seems like you were trying to do. However you don't want to carry over the query string with the redirect so you need to use ? in the rewrite URL.

So if you have a URL like so

http://www.example.com/?page=services/branddevelopment

Then your rule would be

RewriteCond %{QUERY_STRING} ^page=services/branddevelopment$
RewriteRule ^(.*)$ http://domain.com/?   [R=301,L]

这篇关于htaccess的301重定向与查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:49
查看更多