Sep 13, 2018

How to configure URL redirect in Apache

For example, to redirect example.com/superman/I?q=i88ca to i88.ca/super?q=i88ca

.htaccess:
RewriteEngine on
RewriteBase /
RewriteRule ^superman/I?(.*)$ http://i88.ca/super$1 [R=301,L]
For performance, it is better implemented in configuration file. The advantage of .htaccess is that you don't need to restart Apache. So you can put it to both configuration file and .htaccess file, then you can restart Apache later.