0
votes

Hi,
I have my .htaccess code that changes the root directory from public_html to a new-site folder and it's working perfectly.


    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example.com.au$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.example.com.au$
    RewriteCond %{REQUEST_URI} !new-site/
    RewriteRule (.*) /new-site/$1 [L]

the issue with it is: I want to keep a few inner pages from the old site loading from the default directory.

https://example.com.au/load-this-from-the-old-site/
https://example.com.au/load-this-from-the-old-site/another-page/
https://example.com.au/etc/

The above pages are not directories they are pages requested from the old public_html/index.php file

Any help would be appricated

1

1 Answers

0
votes

Insert an exclusion condition in your rule like this:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(?:www\.)?example\.com\.au$ [NC]
RewriteCond %{REQUEST_URI} !^/(new-site|load-this-from-the-old-site|etc)/ [NC]
RewriteRule (.*) new-site/$1 [L]