简体   繁体   中英

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.

Try the following:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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