Redirect URL to new address but keep original

I would like to redirect certain URLs to a template page with a link to the $ _GET variable. More specific:

http://domain/and http://domain/home==> http://domain/main.php?page=home http://domain/about==>http://domain/main.php?page=about

And I would like some words to be redirected to another template, for example: http://domain/login==>http://domain/uam.php?action=login

What is the best way to achieve this?

Again, I want to keep the URLs from which I redirect.

+3
source share
1 answer

Make sure mod_rewrite is installed and loaded, make sure AllowOverride All is installed in the VirtualHost section of your conf file, and put these lines in your .htaccess file in the root directory of the web server document.

RewriteEngine on
RewriteRule ^$ main.php?page=home [L]

RewriteRule ^login uam.php?action=login [L, QSA, NC]

RewriteRule ^(.*)$ main.php?page=$1 [L, QSA, NC]
+2
source

All Articles