I need help with setting up 100% working .htaccess , I Googled a lot, came to several suggestions, part-working ones but still not 100%. The "problem" is quite simple: the site is hosted at: public_html/
dir, but my site is in /public_html/a/b/FE/
and the back-end at: public_html/a/b/BE/
(its PHP), inside i use relative path (require ('../BE/something.php')). So i want a fully working path redirect from public_html/
to public_html/a/b/FE/
.
The .htaccess that "worked" the most is:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# handle domain root and skip subfolders
RewriteCond %{HTTP_HOST} www.site.com
RewriteCond %{REQUEST_URI} !^/a/b/FE
RewriteCond %{REQUEST_URI} \..+$
RewriteRule ^(.*)$ a/b/FE/$1 [L]
# add trailing slash to subfolders (eg abc to: abc/)
RewriteCond %{HTTP_HOST} www.site.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} [^/]$
RewriteRule ^(.*)$ $1/ [L,R=301]
# handle files in subfolders
RewriteCond %{HTTP_HOST} www.site.com
RewriteCond %{REQUEST_URI} !^/a/b/FE
RewriteRule ^(.*)$ a/b/FE/$1/ [L]
It loads the site, but for example i have a captcha.php at /public_html/a/b/BE/captcha.php which generates an image and it cant find the file. I use it as:
<img src="../BE/captcha.php" />
also, in the JS that sits in the FE dir, i call AJAX calls to some back end modules, with th开发者_运维百科eir relative location: '../BE/some_module.php' . This causes error as well
thanks!
精彩评论