可变301重定向URL [英] 301 redirect URL with variable

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

问题描述

我想用htaccess的301重定向(不是重写)的网址,如:

I want to use htaccess to 301 redirect (not rewrite) urls like:

brands.php?品牌=索尼

brands.php?brand=Sony

品牌/索尼

我怎样才能做到这一点?鸭preciate你的帮助提前。

How can i do that? Appreciate your help in advance.

推荐答案

所以,你的用户正在进入 brands.php?品牌=索尼到他们的浏览器,重定向?如果我有正确的,这是简单的:

So your users are entering brands.php?brand=Sony into their browser, and being redirected? If I have that correct, it's simple:

RewriteEngine On
RewriteCond %{QUERY_STRING} brand=([^&]+) [NC]
RewriteRule brands\.php brands/%1 [L,R=301]

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆