简体   繁体   English

具有查询ID的mod_rewrite的重写规则

[英]Rewrite rule for mod_rewrite with query ID

After much googling and digging around I have the feeling I´m very close but still not getting there. 经过大量谷歌搜索和挖掘后,我感到自己非常接近,但仍未到达那里。

I have a URL 我有一个网址

my.url.com/mymeeting.py?view=nicecompact&confId=54

or 要么

my.url.com/myschedule.py?view=nicecompact&confId=54

I would like to turn this to: 我想将其转换为:

my.otherurl.com/conf/event/54 

In order to achieve this I want to use mod_rewrite to capture the number in the confId parameter from URL #1 and append it to the new URL #2. 为了实现这一点,我想使用mod_rewrite从URL#1捕获confId parameter的数字,并将其附加到新的URL#2中。

Try the following: 请尝试以下操作:

RewriteEngine On
RewriteCond %{QUERY_STRING} confId=(\d+)
RewriteRule ^/my(meeting|schedule)\.py /conf/event/%1? [R=302,L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM