Jump to content

.htaccess Treat /new as root folder


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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.