I would like to create admin.example.com
, The URL router I am using is www.example.com/admin
, I do not want to share the same login session. So I am thinking to use subdomain to solve this issue.
the admin actually is not a folder, it is a route from my route file. I am using Laravel 5.1.
What I want is when user access
http://admin.example.com
, it actually pointing to http://www.example.com/admin
. However, user browser still showing http://admin.example.com
Any idea how do I able to in .htaccess?
Options +FollowSymLinks
RewriteEngine on
#Below is the code I added for the admin subdomain which doing a redirect, but I would like a mapping, not redirect
RewriteCond %{HTTP_HOST} ^admin.example.com
RewriteRule ^(.*)$ http://www.example.com/admin/$1 [L,NC,QSA]
#end of subdomain
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Above code what it does is redirect, but what I want to a mapping.
vhost config file
<VirtualHost *:80>
ServerName www.example.com
DocumentRoot "C:\Bitnami\www\example.com\public"
</VirtualHost>
<VirtualHost *:80>
ServerName admin.example.com
DocumentRoot "C:\Bitnami\www\example.com\public"
</VirtualHost>