D_R
D_R

Reputation: 4962

Rewrite URL add parameter with htaccess

How can I add parameter to this url:

http://example.com/?p=10455

for ex:

http://example.com/100/?p=10455

and it will redirect to the same location, only with additional parameter (num=100)?

Upvotes: 2

Views: 1517

Answers (2)

Mario Radomanana
Mario Radomanana

Reputation: 1698

Like this

RewriteRule ^([0-9]+)/$ index.php?num=$1 [L,QSA]

Upvotes: 0

anubhava
anubhava

Reputation: 785146

Place this rule in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteCond %{QUERY_STRING} (^|&)p=10455(&|$) [NC]
RewriteRule ^$ /100/ [L]

Upvotes: 1

Related Questions