When you need to redirect your page based on query string from URL, you can put below code in your .htaccess file !
RewriteEngine on RewriteCond %{REQUEST_URI} ^/array\.php$ RewriteCond %{QUERY_STRING} ^id=([0-9]*)&name=([a-z]*)$ RewriteRule ^(.*)$ http://mywebsite.com/index.php? [R=302,L]
REQUEST_URI will return name of the executed file.
QUERY_STRING will return query string variables in URL.
After you add above code in htaccess , all array.php pages with query string id & name will redirect to http://mywebsite.com/index.php.
Filed under: php Tagged: .htaccess, php, Query string, Uniform Resource Locator, URL redirection
