apache - .htaccess redirecting sub domains to sub domains name folder -


my site structure follows:

/
 static/
 www/
   index.html
   img/
 www2/
   index.html
   img/
 www3/
   index.html
   img/

i have .htaccess following: according subdomain instance www.domain.com/index.html redirect right subdomain folder /www/index.html.

<ifmodule mod_rewrite.c> rewriteengine  on rewritecond %{request_uri} !^/static/* rewritecond %{http_host} ^(.*)\.domain\.com rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /%1/$1 </ifmodule> 

it works when accessing site www.domain.com/index.html not without index.html meaning www.domain.com/ .

i have tried many condition non of them seems work , , if works breaks have now. condition should add redirecting www.domain.com/ /www/index.html ? thanks

edit

the error receiving is: "forbidden don't have permission access / on server." meaning redirected / folder doesnt contains index.html.

to me sounds don't have directory index set. there nothing wrong going directly file apache doesn't consider index.html index file. , directory listing turned off error. don't need rewrite that. use directive. should prevent 403 forbidden.

directoryindex index.html  <ifmodule mod_rewrite.c> rewriteengine  on rewritecond %{request_uri} !^/static/* rewritecond %{http_host} ^(.*)\.domain\.com rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /%1/$1 </ifmodule> 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -