简体   繁体   中英

how do I redirect a folder name as url param using htaccess?

I need to 301 redirect in .htaccess from old site with folder structure to new page that uses the ending folder name as a url param.

like this:

http://example.com/artists/artist-name

to

http://example.com/search-works.php?searchArtist=artist-name

a couple options:

RewriteRule ^artists/artist-name$ /search-works.php?searchArtist=artist-name [R=301,NC,L]

or

RewriteRule ^artists/(.*)$ /search-works.php?searchArtist=$1 [R=301,NC,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