I am trying to make pretty urls for my mobile site. I have a working site for desktop, and will give the user option to enter the mobile version.
I have a php file called mobile.php in same dir as the index.php. the parameters of the sites will be the same. the parameters for the desktop version is working fine, but. If i enter m.example.com it will go to my desktop version, however if i enter m.example.com/something it will go to the mobile version.
# changing www to nonwww
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#redirect for the mobile site
RewriteCond %{HTTP_HOST} ^m.example.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/([^/]+)/?([^/]*)?/?([^/]*)?/?([^/]*)?/? [NC]
RewriteRule ^(.*)$ mobile.php?site=%1&brand=%2&model=%3&repid=%4 [L]
#redirect for dekstop.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/([^/]+)/?([^/]*)?/?([^/]*)?/?([^/]*)?/? [NC]
RewriteRule .* index.php?site=%1&brand=%2&model=%3&repid=%4 [L]
furthermore. When i am at the mobile site, i try to link to my resources src="/image.png". on the desktop it will work fine, but the mobilesite will make the url for the file m.example.com/image.png and can't find the resources. I bypassed by entering the whole URL, but would like to use the other way.
I hope some one can help me out on this ;)