I’m trying to get an htaccess file to redirect. So that when the URL is- http://mobile.domain.tld/index.php?page=home
Apache actually requests http://mobile.domain.tld/index.php?page=home&template=mobile
What I have at the moment is-
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^mobile\.domain\.tld\/index\.php?page=(.+)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d [NC]
RewriteRule ^index.php?page=(.+)$ index\.php?page=$1&template=mobile [QSA,L]
The mobile. subdomain is pointed at public_html but at the moment the “&template=mobile” parameter doesn’t seem to be getting appended.
Any thoughts would be very much appreciated.
This should work.
You missed
RewriteCond %{QUERY_STRING}.