Question

I have the following link:

www.example.com/a.php?pid=1

so this link will show the product , now when a user post a commnet the will be posted to another page and will be redirected to:

www.example.com/a.php?pid=1&suc=1.

How can i convert it to

www.example.com/a/1

I already know ho to do this RewriteRule ^a/([0-9]+)/ camp.php?pid=$1 [NC,L]

but how can i do the second part?

i want the the second part to be like:

www.example.com/a/1/suc/1

Was it helpful?

Solution

You have to write your rules in order of precision.

In your case, it would be:

RewriteEngine on

RewriteRule ^a/([0-9]+)/suc/1$ camp.php?pid=$1&suc=1 [NC,L]
RewriteRule ^a/([0-9]+)$ camp.php?pid=$1 [NC,L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top