Reputation: 3857
I want to create new subdomain for mobile site. so i want to point this domain to subfolder in root folder in my server:
Example: www.mywebsite.com point to www folder
I will create sub folder inside wwww name it: mobile_version I will create subdomain for mobile name it: m.mywebsite.com I want to point m.mywebsite.com to mobile_version folder NOT REDIRECT
if someone open mywebsite from mobile then will redirect to m.mywebsite.com and show the index.php inside mobile_version without redirect to m.mywebsite.com/mobile-version
I hope I passed my issue.
what I did in htaccess:
RewriteCond %{HTTP_HOST} !^m.jeelplus.com$
RewriteRule ^(.*)$ http://m.jeelplus.com/mobile_version/$1 [R=301,L]
Upvotes: 0
Views: 2532
Reputation: 1760
if m.jeelplus.com
is going to map to the sub-directory, then why are you passing the sub-directory as a URI parameter? Also if you want it to re-map, NOT redirect then you can't have [R=301] because this is a redirect...
Your application also needs to determine whether the user is coming from mobile or not, and redirect to your m.jeelplus.com
this can't really be done through .htaccess
your .htaccess will literally redirect every request into the server that isn't m.jeelplus.com
to m.jeelplus.com/mobile_version/
this is probably not what you actually want to do..
I assume you want to rewrite anything coming into m.jeelplus.com
to use /mobile_version/index.php
in which case try something more like:
RewriteCond ${HTTP_HOST} ^m.jeelplus.com$
RewriteRule ^(.*)$ mobile_version/index.php/$1 [L]
Alternative setup a new vhost with its document root pointed to the mobile version folder with the ServerName m.jeelplus.com and use the normal remap .htaccess...
Upvotes: 1