Reputation: 2303
I am cleaning up my root directory, and it has a lot of "trash" inside.
so i am moving all the files so a subfolder "oldroot"
now, some of my users are using some of the trash files....but only 3-4 files....is there an easy and quick way to configure .htaccess to forward these specific files only, like
mypage1.php ==> oldroot/mypage1.php
mypage2.php ==> oldroot/mypage2.php
Upvotes: 0
Views: 106
Reputation: 10898
In your .htaccess file
use:
RewriteEngine On
RewriteBase /
RewriteRule ^(mypage1|mypage2|mypage3)\.php$ oldroot/$1.php [L]
Upvotes: 1
Reputation: 9539
Try adding the following to the .htaccess
file in the root directory of your site.
It will work for any file that you move to oldroot
i.e. all of the files that you want to leave in the root will be served from there.
RewriteEngine on
RewriteBase /
#if the file exists in the oldroot directory
RewriteCond %{DOCUMENT_ROOT}/oldroot%{REQUEST_URI} -f [NC]
# then serve the file from oldroot
RewriteRule ^ /oldroot%{REQUEST_URI} [L]
Upvotes: 0