首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用htaccess从asp页向单个php页面发送多个参数

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

Stack Overflow用户
提问于 2014-11-04 10:03:03
回答 1查看 28关注 0票数 1

我正在训练使用htaccess将多像素参数从不同的asp页发送到单个php页面,但是代码没有将我重定向到php页面,有什么问题吗?

代码语言:javascript
复制
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]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-04 12:42:48

您只需要在根.htaccess中使用这个单一的重定向规则:

代码语言:javascript
复制
RewriteEngine On

## 301 Redirect
RewriteCond %{QUERY_STRING} (^|&)id=\d+ [NC]
RewriteRule ^Paper/printArticle\.asp$ /redirect-url-301.php? [R=301,NE,NC,L]
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26732366

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档