0

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?

  1. I tried with a .htaccess but couldn't manage what to write in order for it to work.
  2. 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.

Protomen
  • 9,471
  • 9
  • 57
  • 124

1 Answers1

0

As an update. I am running wordpress multisite. My www.site3.com comes into the qnap(web or public_html folder) then the NAS virtual host manager redirects it to its actual subfolder (site3). In this situation, when i write :

-anything.site3.com it reads my top (web or public_html) index and i can't get to the wordpress subpages. (my anything.site3.com page has been created from user-end)

-site3.com it goes to mi site3 folder as it should, managed by the qnap virtual host (i don't have to write additional htaccess.

So i need to somehow let my subdomains pass the redirection from the qnap and go to my site3 subfolder and then wordpress htaccess do it's job. This should be done so that i don't have a continuous loop!

Sorry for my explanations might be a little bit messed.