I have multiple domains setup with my webspace (all via a hosting provider)
So www.maindomain.example
links to /maindomain
on my webspace. www.domain2.example
links to /domain2
on my webspace. Pretty simple so far.
However as soon as I place another folder into one of those directories the folder
of the domain itself gets mentioned in the URL
again.
So imagine this … I have a folder test
inside maindomain
. In that case the URL to this folder is not www.maindomain.example/test
but www.maindomain.example/domain2/test
. So the maindomain
directory name that is repeated in the url.
Why is that? Is there a way to make that go away via mod_rewrite
and .htaccess
?
I found this in the .htaccess
file on the root of my
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/maindomain/
RewriteCond %{DOCUMENT_ROOT}/maindomain%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/maindomain%{REQUEST_URI} -d
RewriteRule ^(.*)$ /maindomain/$1 [L]
However, since I'm not much of a server-guru I can't figure out what that actually means.