Jump to content

.htaccess Treat /new as root folder


Guest

Recommended Posts

Hi,

 

I have my current site in the structure below:

/

/index.php

/images

/css

 

etc

 

I have now uploaded a new site to /new

So I have the structure

/

/index.php

/images

/css

/new/index.php

/new/images

/new/css

 

Is there a way I can use .htaccess to make it so when someone goes to the site, it treats the /new folder as the root.

 

I only managed "RedirectMatch ^/$ /new", but that redirects so the user sees the /new...

 

Thanks,

Josh

Link to comment
https://forums.phpfreaks.com/topic/163767-htaccess-treat-new-as-root-folder/
Share on other sites

Hi Josh,

 

The rewrite rule you'll want to use in the .htaccess is:

 

RewriteEngine On

RewriteBase /

 

RewriteCond %{HTTP_HOST} domain.com

RewriteCond %{REQUEST_URI} !<subfolder>/

RewriteRule ^(.*)$ <subfolder>/$1 [L]

 

Save the changes & you should be good to go

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.