Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invisibly rewriting root to subdirectory using mod_rewrite (ajaxplorer)

I've been looking on various sites reading mod_rewrite examples for a few hours, and have used it many times before successfully... but I'm trying something new with it now and can't for the life of me get it working!

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

I still want to be able to access the other files/directories on the root as normal just typing in the path.

I assume this is possible? Seems relatively simple but I just can't get it working.

AjaXplorer seems to load js files and images etc from /ajaxplorer-core-4.0.4/plugins, I have a feeling that's where it's tripping me up.

Any pointers would be massively appreciated! Thanks

like image 837
BT643 Avatar asked Jun 08 '12 17:06

BT643


1 Answers

Found it on another answer luckily :)

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]
like image 141
BT643 Avatar answered Sep 19 '22 16:09

BT643