Tarik
Tarik

Reputation: 81711

URL Rewriting Question in Apache

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.something.com/press/release/press_detail.php?rid=1

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

Upvotes: 2

Views: 87

Answers (1)

user142162
user142162

Reputation:

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]

Upvotes: 2

Related Questions