I need to rewrite the following url
component/iproperty/?view=property&id=53
to go to
redirect.php?id=53
using the .htaccess file
the id=53 can be any id at all (always a number)
In your .htaccess ...
RewriteEngine On
RewriteRule ^component/iproperty/?view=property&id=([0-9]+)?$ redirect.php?id=$1 [L]
This should do the trick:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^component/iproperty/?view=property&id=([0-9]+)?$ redirect.php?id=$1 [L]
This wil do exactly what you asked for:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^view=property&id=(\d+)
RewriteRule ^component/iproperty/?$ /redirect.php?id=%1 [L]
Change [L]
to [R=301,L]
if you want it to redirect the user's browser.
RewriteRule ^component/iproperty/?view=property&id=(\d+)?$ redirect.php?id=$1 [L]