Htaccess redirect all parameter pages
I need all pages of my site to redirect to home.php with query string and page as parameter
examples:
www.site.com/abcd
-> www.site.com/home.php?page=abcd
www.site.com/abcd/file.php
-> www.site.com/home.php?page=abcd/file.php
www.site.com/file.php?a=b&c=d
-> www.site.com/home.php?page=file.php&args="a=b&c=d"
-3
source to share
1 answer
You can put this in your .htaccess file:
RewriteEngine On
RewriteRule ^(.+)$ home.php?page=$1 [QSA,L]
This will do what you want, except for the passed parameters, they will display in their original form:
www.site.com/file.php?a=b&c=d -> www.site.com/home.php?page=file.php&a=b&c=d
+2
source to share