Wildcards in .htaccess Wildcards in .htaccess apache apache

Wildcards in .htaccess


You can use this code in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine OnRewriteCond %{QUERY_STRING} (^|&)info_id=.+ [NC]RewriteRule ^info2\.cfm$ /? [R=301,L]


You could make a Redirect via your httpd.conf (or other .conf file) in Apache (assuming you're using Apache). Within that, there will be an option to add your redirects. You can either include

Redirect info2.cfm where_you_want_it_to_redirect<Directory where_you_want_it_to_redirect>  Order allow,deny  Allow from all</Directory>

or...

RedirectMatch info2.cfm(.*) where_you_want_it_to_redirect$1<Directory where_you_want_it_to_redirect>  Order allow,deny  Allow from all  Options +FollowSymLinks</Directory>

...if you'd also like to regex functionality.

Each time you do it too, you'll need to restart Apache.