Trombone0904
Trombone0904

Reputation: 4258

url rewrite rule for paramters

I have the following URL:

https://www.mydomain.de/termin_cancel=c502b486-e8ad-490a-a615-80307a515fc8

Original url:

https://www.mydomain.de/index.php?termin_cancel=c502b486-e8ad-490a-a615-80307a515fc8

rewrite rule:

RewriteRule ^termin_cancel=([\w-]+)/?$ index.php?termin_cancel=$1 [L,NC,QSA]

This works !

But now I have a problem with the next situation:

The url should be:

https://www.mydomain.de/termin_change=XXX&serviceID=XXX&firstname=XXX&lastname=XXX&email=XXX

original url:

https://www.mydomain.de/index.php?termin_change=XXX&serviceID=XXX&firstname=XXX&lastname=XXX&email=XXX

I don't know which htaccess rule work fo this. It should be possible to access the parameters via php $_GET.

Upvotes: 1

Views: 67

Answers (3)

RavinderSingh13
RavinderSingh13

Reputation: 133428

Could you please try following.

RewriteEngine ON
RewriteRule ^(.*) index.php?$1 [QSA,NE,L]

OR with / in case your index.php is present in root directory/folder.

RewriteEngine ON
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(.*) /index.php?$1 [QSA,NE,L]

OR(either put above or put following)

RewriteEngine ON
RewriteCond %{QUERY_STRING} ^$
RewriteCond %{REQUEST_URI} ^/termin_change=.*/?$ [NC]
RewriteRule ^(.*) /index.php?$1 [QSA,NE,L]

Upvotes: 1

Amit Verma
Amit Verma

Reputation: 41219

This should work for you.

RewriteRule ^termin_change=([^&]+)&serviceID=([^&]+)&firstname=([^&]+)&lastname=([^&]+)&email=([^&]+)$ /index.php?termin_change=$1&serviceID=$2&firstname=$3&lastname=$4&email=$5 [L,NC]

Upvotes: 1

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

Try, something like below specifically for termin_change=

RewriteRule ^termin_change=(.+)/?$ index.php?termin_change=$1 [L,NC,QSA]

Upvotes: 0

Related Questions