使用htaccess从asp页面向单个php页面发送多个参数

时间:2014-11-04 10:03:03

标签: .htaccess

我尝试使用htaccess从不同的aspx页面发送多个参数到单个php页面但是代码不会将我重定向到php页面出错了什么?

RewriteEngine On

## 301 Redirects
# 301 Redirect 1
RewriteCond %{QUERY_STRING}  ^id=1$ [NC]
RewriteRule ^Paper/printArticle\.asp$ /redirect-url-301.php? [R=301,NE,NC,L]

# 301 Redirect 2
RewriteCond %{QUERY_STRING}  ^idr=1&idrs=2&id=3$ [NC]
RewriteRule ^Paper/Article\.asp$ /redirect-url-301.php? [R=301,NE,NC,L]

# 301 Redirect 3
RewriteCond %{QUERY_STRING}  ^idr=1&id=2$ [NC]
RewriteRule ^News/Article\.asp$ /redirect-url-301.php? [R=301,NE,NC,L]

1 个答案:

答案 0 :(得分:0)

您只需在根目录中使用此单一重定向规则.htaccess:

RewriteEngine On

## 301 Redirect
RewriteCond %{QUERY_STRING} (^|&)id=\d+ [NC]
RewriteRule ^Paper/printArticle\.asp$ /redirect-url-301.php? [R=301,NE,NC,L]