开发者

URL Rewriting Question in Apache

开发者 https://www.devze.com 2023-03-17 08:39 出处:网络
I am doing a php project but I am not good at url_rewrite module in apache and I wanna learn how to achieve this kind of url rewrite here:

I am doing a php project but I am not good at url_rewrite module in apache and I wanna learn how to achieve this kind of url rewrite here:

http://www.something.com/press/release/something_1/

01 will be id of the press_release so that part will be dynamic part. something is also dynamic but not included in query_string part. This url is converted to the one below:

http://www.som开发者_高级运维ething.com/press/release/press_detail.php?rid=1

Can somebody show me how to write the url_rewrite rule for this conversion.


Place the following in the .htaccess file in your web root:

RewriteEngine on
RewriteRule ^press/release/.*_(\d+)/?$ press/release/press_detail.php?rid=$1 [QSA]
0

精彩评论

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

关注公众号