I have DNS managed by NO-IP and self hosted websites on a QNAP, with Virtual hosts defined in the Qnap Software.
My sites are www.site1.com
, www.site2.com
and a new www.site3.com
which (this one will work with subdomains created by wildcards at Users input in Joomla) (ex user1.site3.com
would be the redirection of the site3.com/index.php/users/user1) and all are located in (root) web_folder/site1/...site2/...site3/
. The other sites have their virtual hosts working right.
Now, before doing that, i am getting stuck on this Qnap issue where i can't define my wildcard dns *.site3.com
in the virtual hosts. I want to do this because when i enter in the browser anything.site3.com it gets me to the index.html file located in the root folder of my published sites (web/index.html)
What shoud I try in order for the subdomains to pass the root index and go directly to the website folder, where i could place my .htaccess containing the rewrite rules?
- I tried with a .htaccess but couldn't manage what to write in order for it to work.
- Define the wildcard in the qnap virtual host but does not accept
What am i thinking wrong?
I would like to avoid having a .htacces, in the web folder, to redirect every domain/subdomain to it's respective subfolder and afterwards having another .htaccess insinde my site3 folder which does the rest of the rewrites (subdomains wildcard and user based)
I have managed to do so far:
I shall partially answer to my question
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{HTTP_HOST} !^www\.site3\.com<br>
RewriteCond %{HTTP_HOST} !^static\.site3\.com<br>
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)\.site3.com$ [NC]
RewriteRule ^(.*)$ http://site3.com/index.php/user/%2 [L]
The thing is, I would like to still see user.site3.com
instead of the full link.