views:

60

answers:

2

Hello

I've domain using wildcard dns but I want my main site example.com will grab content from folder /home/ by example.

  1. If user type http://www.example.com/ or http://example.com/ site will read file from subfolder /public_html/home/
  2. If http://subdomain.example.com/ will reading content from /public_html/.

Let me know how to that in my .htaccess.

A: 

you don't need htaccess or mod-rewrite for that. just config your site's document root dir to be /var/www/home/ or whatever you want it.

for example, in apache2 you can put this in apache-dir/sites-enabled/000-default/

NameVirtualHost *:80

<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName domain.com
        DocumentRoot /var/www/home/
        <Location "/">
                allow from all
        </Location>
</VirtualHost>
Ofri Raviv
ok thanks mate. the problem I have no access to httpd conf :)
bob
+2  A: 

Try this rules:

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RewriteRule !^home/ home%{REQUEST_URI} [L]
Gumbo
superb! thank gumbo working perfect. huhu
bob