regex - htaccess re-write for subfolders? -


maybe can point me in right direction i'm trying do. i'm trying re-write subfolders re-direct 1 folder while keeping first subfolder info, along rest of url.

example:

http://www.example.com/billy/profile/info.php

http://www.example.com/mike/profile/info.php

http://www.example.com/sarah/profile/info.php

http://www.example.com/mark/profile/info.php

where redirect to:

http://www.example.com/home/profile/info.php?user_name=$1 can user name , redirect correct page.

you can use code in document_root/.htaccess file:

rewriteengine on rewritebase /  rewriterule ^(?!home/)([^/]+)/(profile/info\.php)$ home/$2?user_name=$1 [l,qsa,nc] 

Comments