raskolnnikov
raskolnnikov

Reputation: 37

htaccess rewrite GET request to another GET request

I'm trying to rewrite the following URL:

http://mysite.com/app/checkout/success?token=2V5W&PayerID=WBBQER

to

http://mysite.com/app/index.php?url=checkout/process/2V5W/WBBQER


This rewrite is only needed for GET request of the format (/checkout/success?token=xx&payerID=xx), where both "token" and "payerID" are fixed parameters.

I'm also including my current .htaccess:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)$ index.php?url=$1

I've been trying countless .htaccess possibilities to no avail so your help will be greatly appreciated.

Upvotes: 0

Views: 1020

Answers (1)

KodeFor.Me
KodeFor.Me

Reputation: 13511

Try this

RewriteCond %{QUERY_STRING}  ^token=([^\&]+)&PayerID=(.*)$ [NC]
RewriteRule ^app/checkout/success$ http://mysite.com/app/index.php?url=checkout/process/$1/$2 [R=301,NE,NC,L]

Upvotes: 4

Related Questions