RewriteCond %{THE_REQUEST} \?event_id=154 RewriteRule ^events/(index.php)$ www.xyz.com/amit2011/? [R=301,L] RewriteCond %{THE_REQUEST} \?event_id=156 RewriteRule ^events/(index.php)$ www.xyz.com/munjal2011/? [R=301,L] RewriteCond %{THE_REQUEST} \?event_id=157 RewriteRule ^events/(index.php)$ www.xyz.com/smayra2011/? [R=301,L] RewriteCond %{THE_REQUEST} \?event_id=158 RewriteRule ^events/(index.php)$ www.xyz.com/vandna2011/? [R=301,L]
I have many more rewrite rules like this based on event_id. As the event_id increases rewrite rules will be increased propotionaly. Can we merge these above rules, so that i can minimized the code of htaccess.
\?event_id=(\d+)
request to a single local PHP page/file which would map numerical ID to those "amit2011" etc and then redirect to "www.xyz.com/amit2011/" or something like that. Though, if you have an access to the server config and can configure VirtualHost, mario's solution might be better. – binaryLV