Domanda

I have a home server with CENTOS.

- public 
   - www
     - SITE1
     - SITE2
     - SITE3
     - SITE4
     - .htaccess

With dyndns i visualize my sites.

Now I have 4 domain: site.com, site.org, site.net, site.biz.

Now changing dns CNAME all my site point to my home server.

I want that when I am in site.com the root is SITE1, when I'm in site.org is SITE2,etc...

I try with htaccess, for the first site it work

   RewriteEngine On

   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{HTTP_HOST} ^site.com$ [NC]
   RewriteRule ^$ /SITE1/ [L]
   RewriteRule ^(.*)$ /SITE1/$1

   RewriteCond %{SCRIPT_FILENAME} -d
   RewriteRule ^SITE1/(.*[^/])$ http:// site.com/$1/ [R=301]
È stato utile?

Soluzione

You can use rule like this:

RewriteCond %{HTTP_HOST} ^site\.com$ [NC]
RewriteRule ^((?!SITE1/).*)$ /SITE1/$1 [L,NC]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top