动力301重定向重定向、动力

2023-09-02 10:03:17 作者:諗

我们取得了我们的新网站动态页面范围的错误,并有一些不正确的页面已经爬行在谷歌。

我需要重定向的格式如下: http://www.domain.com/dir/dir/?q=120

为以下格式: http://www.domain.com/dir/dir/?p=120

唯一的区别是'Q'需要一个'P'。

RewriteEngine叙述上,因为我已经整合从domain.com交通到www.domain.com

301重定向网页跳转

这是我在我的根.htaccess文件:

 选项+了FollowSymLinks
RewriteEngine叙述上
的RewriteCond%{HTTP_HOST} ^ centerline.com [NC]
重写规则^(。*)$ http://www.domain.com/$1 [L,R = 301]
重写规则^(/领导能力/细节/)?Q =([0-9] +)$ $ 1&P = $ 2 [R = 301,L]
 

解决方案

试试这个:

 的RewriteCond%{QUERY_STRING} Q =([0-9] +)$
重写规则^(。*)/ $ 1?p值= 1%[L,R = 301]
 

您将需要的RewriteCond 作为阿帕奇不允许对匹配的查询字符串重写规则

修改

 的RewriteCond%{REQUEST_URI} ^ /领导能力/细节/ $
的RewriteCond%{QUERY_STRING} Q =([0-9] +)$
重写规则^(。*)/ $ 1?p值= 1%[L,R = 301]
 

We made a mistake in the scope of our dynamic pages on a new site, and have some incorrect pages already spidered in Google.

I need to redirect the following format: http://www.domain.com/dir/dir/?q=120

To this format: http://www.domain.com/dir/dir/?p=120

Only difference is the 'q' needs to be a 'p'.

RewriteEngine is on, as I've already consolidated traffic from domain.com to www.domain.com

This is what I have in my root .htaccess file:

Options +FollowSymLinks 
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^centerline.com [NC] 
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301] 
RewriteRule ^(/leadership/detail/)?q=([0-9]+)$    $1?p=$2 [R=301, L]

解决方案

Try this:

RewriteCond %{QUERY_STRING} q=([0-9]+)$
RewriteRule ^(.*)$ /$1?p=%1 [L,R=301]

You'll need the RewriteCond as apache doesn't allow matching against the querystring in a RewriteRule

EDIT

RewriteCond %{REQUEST_URI} ^/leadership/detail/$
RewriteCond %{QUERY_STRING} q=([0-9]+)$ 
RewriteRule ^(.*)$ /$1?p=%1 [L,R=301]