Mobile app version of vmapp.org
Login or Join

Login to follow query

More posts by @Becky754

1 Comments

Sorted by latest first Latest Oldest Best

 

@Karen161

Not sure if you want to redirect only 144=>1556 or it is just an example. Anyway you can try this:

Options +FollowSymlinks -MultiViews
RewriteEngine On

RewriteCond %{QUERY_STRING} (^|&)id=144(&|$) [NC]
RewriteRule ^(index.php)/?$ /?id=1556 [NC,R,L]


Explanation:


RewriteCond is making sure there is id=144 in query string
RewriteRule is making sure that request URI is index.php (optionally followed by a trailing slash).
If both conditions are satisfied then rule will redirect to /index.php?id=1556. (Note use of back reference instead of repeating index.php here).
Flags used are:


NC - ignore case comparison
R - redirect (by default with status = 302)
L - Mark it as last rule



If you really want to replace multiple old IDs to new IDs then I will suggest you to take a look at: httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritemap

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme