我想使用htaccess或php将旧url重定向到新的重写url

我想使用htaccess或php将旧url重定向到新的重写url,php,.htaccess,url,redirect,rewrite,Php,.htaccess,Url,Redirect,Rewrite,我有一个问题,因为我使用重写url 我的旧网址: Website.com/index.php?act=appdetail&appid=oWV 新的重写URL http://website.com/angry_birds_rio-appdetail-oWVi.html 但我所有的旧url都在谷歌上建立了索引,如果有人访问我的网站,它会显示旧url,谷歌也会为新url建立索引。其在网站上制作重复页面的问题 让我知道解决办法 我的重写URL访问权限 重新启动发动机 重写规则^([^-])-([^-])

我有一个问题,因为我使用重写url

我的旧网址:
Website.com/index.php?act=appdetail&appid=oWV

新的重写URL
http://website.com/angry_birds_rio-appdetail-oWVi.html

但我所有的旧url都在谷歌上建立了索引,如果有人访问我的网站,它会显示旧url,谷歌也会为新url建立索引。其在网站上制作重复页面的问题

让我知道解决办法

我的重写URL访问权限

重新启动发动机

重写规则^([^-])-([^-])-([^-])-([^-])-([^-])-([^-])-([^-]*).html$index.php?appanme=$1&act=$2&appid=$3&page=$4&cat=$5[L]

重写规则^([^-])-([^-])-([^-])-([^-])-([^-])-([^-])-([^-])-([^-]).html$index.php?appanme=$1&act=$2&appid=$3&page=$4&cat=$5&ssString=$5[L]

重写规则^([^-])-([^-])-([^-]*).html$index.php?appanme=$1&act=$2&appid=$3[L]


这是您的.htaccess文件:

RewriteEngine on
RewriteRule ^/index.php?act=appdetail&appid=oWV$ http://website.com/angry_birds_rio-appdetail-oWVi.html [R=301,L] 

您需要通知网络爬虫有关重定向的信息,您可以使用301代码进行重定向。

这是您的.htaccess文件:

RewriteEngine on
RewriteRule ^/index.php?act=appdetail&appid=oWV$ http://website.com/angry_birds_rio-appdetail-oWVi.html [R=301,L] 

您需要通知网络爬虫有关重定向的信息,您可以使用301代码进行重定向。

显示规则基于.htaccess;如果存在一组CGI参数,则需要一组额外的规则将index.php页面的(301)浏览器/爬虫程序请求永久重定向到相应的别名,这将在几周内清理Google。然后你的规则在上面

RewriteEngine On
RewriteBase /

#Permanently redirect BROWSER requests for the index.php?xxx to the appropriate page alias:
RewriteCond %{THE_REQUEST}      /index.php     [NC]
RewriteCond %{QUERY_STRING}     ^appanme=([^&]+)&act=([^&]+)&appid=([^&]+)&page=([^&]+)&cat=([^&]+)&sString=([^&]+)  [NC]
RewriteRule ^.*                 http://%{HTTP_HOST}/%1-%2-%3-%4-%5-%6.html [R=301,L]

RewriteCond %{THE_REQUEST}      /index.php     [NC]
RewriteCond %{QUERY_STRING}     ^appanme=([^&]+)&act=([^&]+)&appid=([^&]+)&page=([^&]+)&cat=([^&]+)  [NC]
RewriteRule ^.*                 http://%{HTTP_HOST}/%1-%2-%3-%4-%5.html   [R=301,L]

RewriteCond %{THE_REQUEST}      /index.php     [NC]
RewriteCond %{QUERY_STRING}     ^appanme=([^&]+)&act=([^&]+)&appid=([^&]+)  [NC]
RewriteRule ^.*                 http://%{HTTP_HOST}/%1-%2-%3.html   [R=301,L]

# Followed by: YOUR RULES FROM ABOVE
注意

1) 您的第二条规则中似乎有输入错误:sString=$6而不是sString=$5


2)如果你不清楚上面的规则是怎么做的,Apache文档是值得阅读的,或者如果你想要一些更抽象的东西,请考虑下面的内容。p> 显示规则基于.htaccess;如果存在一组CGI参数,则需要一组额外的规则将index.php页面的(301)浏览器/爬虫程序请求永久重定向到相应的别名,这将在几周内清理Google。然后你的规则在上面

RewriteEngine On
RewriteBase /

#Permanently redirect BROWSER requests for the index.php?xxx to the appropriate page alias:
RewriteCond %{THE_REQUEST}      /index.php     [NC]
RewriteCond %{QUERY_STRING}     ^appanme=([^&]+)&act=([^&]+)&appid=([^&]+)&page=([^&]+)&cat=([^&]+)&sString=([^&]+)  [NC]
RewriteRule ^.*                 http://%{HTTP_HOST}/%1-%2-%3-%4-%5-%6.html [R=301,L]

RewriteCond %{THE_REQUEST}      /index.php     [NC]
RewriteCond %{QUERY_STRING}     ^appanme=([^&]+)&act=([^&]+)&appid=([^&]+)&page=([^&]+)&cat=([^&]+)  [NC]
RewriteRule ^.*                 http://%{HTTP_HOST}/%1-%2-%3-%4-%5.html   [R=301,L]

RewriteCond %{THE_REQUEST}      /index.php     [NC]
RewriteCond %{QUERY_STRING}     ^appanme=([^&]+)&act=([^&]+)&appid=([^&]+)  [NC]
RewriteRule ^.*                 http://%{HTTP_HOST}/%1-%2-%3.html   [R=301,L]

# Followed by: YOUR RULES FROM ABOVE
注意

1) 您的第二条规则中似乎有输入错误:sString=$6而不是sString=$5


2)如果你不清楚上面的规则是怎么做的,Apache文档是值得阅读的,或者如果你想要一些更抽象的东西,请考虑下面的内容。p> 这对我没有帮助。。我需要一个解决办法。。我不好,这对我没有帮助。。我需要一个解决办法。。我不太容易接近