htaccess:重定向动态网址-仅显示静态网址-重复内容 [英] htaccess: Redirect a Dynamic URL - Show only Static URL - Double Content

查看:63
本文介绍了htaccess:重定向动态网址-仅显示静态网址-重复内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一条重写规则来获取干净的网址..唯一的问题是,google显示了一些动态网址,但我不想提供动态网址.

I have a rewrite rule to get clean urls.. the only problem is, google shows some dynamic url and i dont want to serve dynamic urls.

我想要的是:如果用户输入动态网址,他将被重定向到干净的网址.例如:

What I want: if a user types in the dynamic url, he gets redirected to the clean url.. example:

    http://www.example.com/?index=bananas 
    (if someone types that in, he gets redirect to the url above)
    http://www.examplcom/bananas/

这是我的htaccess:

this is my htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond $1 !apple\+banana
RewriteRule ^(.*)\+apple\+banana/$ ?q=$1 [L]

谢谢!

推荐答案

好,重试:)

RewriteCond %{QUERY_STRING} ^index=([a-zA-Z0-9]+)$
RewriteRule ^/ /%1? [R=302,L]

这篇关于htaccess:重定向动态网址-仅显示静态网址-重复内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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