I want to redirect the home page which is mydomain.com to mydomain.com/index.php?cat=home
here is my htacess file rules:
RewriteRule index.php index.php?cat=home [L]
RewriteRule (.*)-live-streaming-online.html index.php?cat=$1 [L]
when both are active every page in my site whatever the cat is redirected to index.php?cat=home
what is wrong with this htacess?
Have your rules like this in your DOCUMENT_ROOT/.htaccess
file:
RewriteEngine On
RewriteRule ^(.+?)-live-streaming-online\.html$ /index.php?cat=$1 [NC,L,QSA]
RewriteCond %{THE_REQUEST} \s/+(index\.php)?[\s/?] [NC]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^ /index.php?cat=home [L]
Key is to use %{THE_REQUEST}
which represents original request received by Apache. Other using URI patten from RewriteRule
can change based on your other rule.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.