简体   繁体   中英

htaccess Rewrite rules for directory

I need to have a rewrite rule that does the following:

User hits:

www.mysite.com/browse/red/cat/hat/joe.html/_/z-5
www.mysite.com/browse/shoes.html/_/z-2
www.mysite.com/browse/black/car.html/_/z-39a

Server reads to:

www.mysite.com/browse/red/cat/hat/joe.html?e=z-5
www.mysite.com/browse/shoes.html?e=z-2
www.mysite.com/browse/black/car.html?e=z-39a

So the key thing to go off of is the starting of browse and the "/_/". I'm struggling with grabbing everything between the two.

RewriteRule (.*)\\/_\\/(.*) $1?e=$2 [L]

您可以使用以下规则:

RewriteRule ^(.+?\.html)/_/([^/]+)/?$ $1?e=$2 [L,NC,QSA]

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