简体   繁体   中英

Remove a url segment with .htaccess

My current url is

http://foo.com/{first_parameter}/{second_parameter}

Now I want to redirect it to

http://foo.com/{second_parameter}

How can I do it using htaccess ?

NB: I'm using apache server

Try this solution:

RewriteRule ^([^/]*)/(.*)$ /$2 [R=301,L]

You can see it working here :

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