Mod rewrite rule for url with get parameters

59 Views Asked by At

I have a domain called wwww.website.com. There, I have a subdirectory called www.website.com/register.

In this directory, I have a .htaccess file, which redirect urls for example likes this:

www.webseite.com/register/confirmation

to

www.webseite.com/register/confirmation.php

Now, what I want is a redirection like this:

www.webseite.com/register/verification/454654/12345

to

www.webseite.com/register/verification.php?a=454654&b=12345

At the moment, my .htaccess file is located in the register directory, and lokks like this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]

Does anybody know, how i have to modify this .htaccess file?

Thank you,

Julian

1

There are 1 best solutions below

1
On BEST ANSWER

You can use the following rules :

RewriteEngine On

RewriteRule ^verification/([0-9]+)/([0-9]+)/?$ verification.php?a=$1&b=$2 [NC,QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+)$ $1.php [L,QSA]