joseav
joseav

Reputation: 81

.htaccess RewriteRule help

I've been trying to create a rule.

If anyone could help, I would be extremely grateful.

Request: domain.com/c/wb.php?p=rs/rs/1tb/25n/ru/rs

Rewrite to: domain.com/c/wb/rs/rs/1tb/25n/ru/rs

Thanks in Advance

Upvotes: 0

Views: 73

Answers (2)

Brian Kintz
Brian Kintz

Reputation: 1993

I think you have this a bit backwards. The idea behind URL rewriting is that you take a nice neat URL like this (what the user sees):

http://domain.com/c/wb/rs/rs/1tb/25n/ru/rs

and rewrite it behind the scenes into an uglier but PHP etc. friendlier URL like this (what the server processes):

http://domain.com/c/wb.php?p=rs/rs/1tb/25n/ru/rs

To do that, use this:

RewriteEngine On
RewriteRule ^/c/wb/(.*) http://domain.com/c/wb.php?p=$1 [L, NS]

Upvotes: 1

Gedrox
Gedrox

Reputation: 3612

It should look something like this

RewriteRule ^(c/wb)\.php\?p=(rs/rs/1tb/25n/ru/rs)$ $1/$2 [L,NS]

Still I'm not sure if you need slash in front of c/wb if you're using this in your .htaccess file. You need slash if you're using this in the VirtualHost configuration.

Upvotes: 0

Related Questions