Aakash Mishra
Aakash Mishra

Reputation: 1

Want to rewrite url using htaccess with parameters

The challenge is I need to pass parameter received in the URL

Https://mydomin.com/asdfg/website/view.php?v=qwertyuiop

To

Https://mydomin.com/asdfg/website/view/qwertyuiop

Upvotes: 0

Views: 56

Answers (1)

RavinderSingh13
RavinderSingh13

Reputation: 133518

Could you please try following.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(.*)/([\w-]+)$
RewriteRule ^.*$ /%1.php?v=%2 [NC,L,QSA]

OR to check if view.php is present in local path you could try:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(.*)/([\w-]+)$
RewriteCond %{DOCUMENT_ROOT}/%1.php -f
RewriteRule ^.*$ /%1.php?v=%2 [NC,L,QSA]

Upvotes: 1

Related Questions