redirect to subfolder and then hide subfolder from url

246 views Asked by At

i have a url: www.example.co.za.

when i go to that url i can see my directory structure. This is my document root and needs to remain my document root so that i can access all underlying folders.

inside my document root i have the following folders. "auction","common".

auction contains "www" folder which is where my index.php file is.

My goal is to access example.co.za and then it must load "/auction/www". My url will then be "www.example.co.za/auction/www/index.php" but i dont want "/auction/www"in the url.

Can someone please help me with this. i suck at htaccess :(.

I dont want linked folders, other vhosts etc. I just need what i explained above.

2

There are 2 answers

3
Jon Lin On

Try:

RewriteEngine On
RewriteRule ^(index.php|)$ /auction/www/index.php [L]
0
David On

This may now be the "definitive" answer or the "best way" to do it because .htaccess isn't my strongest area, but something like this should get you on the right path:

Be sure to put this in the .htaccess file in the root directory.

RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ auction/www/$1 [L]

You can expand on this with alternative paths for a multi-app site, eg:

RewriteEngine on
RewriteBase /
RewriteRule ^auction/(.*)$ auction/www/$1
RewriteRule ^otherthing/(.*)$ otherthing/www/$1 [L]

etc.

So in the second example when you go to www.mysite.co.za/auction you'll be redirected to the content in auction/www, and if you go to www.mysite.co.za/otherthing you'll be redirected accordingly.

EDIT: added second example