简体   繁体   中英

URL Rewrite: PHP variable as directory

Alright, how would I get something like:

domain.com/friends.php?id=Fred

Into something like:

domain.com/Fred/friends.php

Previously, I have used:

RewriteRule ^([A-Za-z0-9]+)$ profile.php?id=$1 [L]

To turn

domain.com/profile.php?id=Fred

Into

domain.com/Fred

I know there is a way to do it, I just don't have the knowledge of the operators that would put that extra 'friends.php' in the RewriteRule. Thanks for the help, if my explanation made sense.

您接近:

RewriteRule ^([A-Za-z0-9]+)/friends\.php$ friends.php?id=$1 [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