开发者

Dynamic Mod_Rewrite

开发者 https://www.devze.com 2023-02-18 14:38 出处:网络
I\'m looking for help creating a mod_rewrite rule for my website. Here is an example of what the current link looks like http://soccersurfer.com/profile.php?id=3 and I would like it turn into somethi

I'm looking for help creating a mod_rewrite rule for my website.

Here is an example of what the current link looks like http://soccersurfer.com/profile.php?id=3 and I would like it turn into something like http://socce开发者_如何学JAVArsurfer.com/players/cristiano-ronaldo/. I have a lot of links like this, so it's not as simple as doing it for one, but for "profile.php?id=X" where X is the profile number.

Any help would be appreciated.

Thanks


The easier way would be:

RewriteRule ^/players/(.*?)/$ profile.php?name=$1

And in profile.php, add a possible argument (the name one) which lets you search the player in the database by his name rather than his ID.

0

精彩评论

暂无评论...
验证码 换一张
取 消