.htaccess - Check for a directory inside a subdirectory dynamically -


i have bunch of domains points same directory "public_html" on host.
there .htaccess file in main folder locally redirects each domain particular folder same name %{http_host} mod_rewrite variable. (eg: redirect www.domain.com public_html/www.domain.com/)

this content of .htaccess:

rewriteengine on rewritebase / rewritecond /%{http_host}/#%{request_uri} !^([^#]+)#\1 rewriterule ^(.*)$ %{http_host}/$1 [l] 

i'm having problem when comes directory slash directive.
if try access folder in domain url without forward slash http://www.domain.com/folder, mod_dir applies directoryslash , externally redirects request http://www.domain.com/www.domain.com/folder/

i tried applying 301 redirect after domain directory redirect this:

rewritecond %{request_filename} -d rewriterule ^(.*[^/])$ $1/ [r=301,l] 

but work, have able check if %{request_filename} exists inside %{http_host} 'folder'. tried following, no success:

rewritecond /%{http_host}/%{request_filename} -d rewriterule ^(.*[^/])$ $1/ [r=301,l] 

how can check, dynamically, if %{request_filename} directory, inside directory same name %{http_host}?

thanks in advance

if work -d need provide absolute filesystem path. try this:

rewritecond %{document_root}/%{http_host}%{request_uri} -d rewriterule ^(.*[^/])$ $1/ [r=301,l] 

Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -