I have a domain example.com
, as well as some sub-domains sub1.example.com
, sub2.example.com
, ..etc. I want to load the main domain from a directory to organize the directories to avoid having Laravel project files and folders next to sub-domains folders.
public_html
structure:
main
app
bootstrap
..
public
..
sub1
//Some files and directories
sub2
//Some files and directories
.htaccess
.htaccess:
RewriteCond %{HTTP_HOST} ^(?:www\.)?example\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/main/ [NC]
RewriteRule ^(.*)$ /main/public/$1 [L]
This code will load files for example.com from example.com/main/public
.
The issue is that when I leave the website opened in a browser tab for a while (maybe a couple of hours) and visit that tab, the URL becomes example.com/main/public
. If I type example.com/main/public
in the browser the website loads as well.
Is there a way to force it to load the website from example.com
only?
This code will load files for example.com from example.com/main/public
OkayURL becomes example.com/main/public
It should because same page(Unless you have inactive catchers ).If I type example.com/main/public in the browser the website loads as well.
???main/public
. The website should be loaded fromexample.com
only.