Invisibly rewrite root into a subdirectory using mod_rewrite (ajaxplorer)

I looked at different sites reading mod_rewrite examples for several hours, and used them many times before successfully ... but I’m doing something new with it now and I can’t get it working for life!

I am using a PHP file manager tool called AjaXplorer, I have it in a subdirectory in the root directory of my server /ajaxplorer-core-4.0.4. When I go to the root of my site http://domain.com/, I want it to be invisibly redirected to a folder /ajaxplorer-core-4.0.4(but still shows the root domain in the address bar).

I still want to have access to other files / directories in the root, as usual, just by entering the path.

I assume this is possible? It seems relatively simple, but I just can't get it to work.

It seems that AjaXplorer is loading js files and images, etc. of /ajaxplorer-core-4.0.4/plugins, I feel that where he disconnects me.

Any pointers will be judged by weight! Thanks

+5
source share
2 answers

Probably found it on another answer :)

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^(www.)?site.com$ 
RewriteCond %{REQUEST_URI} !^/subdir/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /subdir/$1 
RewriteCond %{HTTP_HOST} ^(www.)?site.com$ 
RewriteRule ^(/)?$ subdir/index.php [L]
+10
source

And if this is not enough:

Two tips:

If you do not host in a hosted environment (= if your own server can change virtual hosts, not just files .htaccess), try using the directive RewriteLog: this will help you identify such problems:

# Trace:
# (!) file gets big quickly, remove in prod environments:
RewriteLog "/web/logs/mywebsite.rewrite.log"
RewriteLogLevel 9
RewriteEngine On

My favorite regexp checker tool:

http://www.quanetic.com/Regex ( ereg (POSIX) preg (PCRE)!)

0

All Articles