LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Using .htaccess instead of symlinks (https://www.linuxquestions.org/questions/linux-server-73/using-htaccess-instead-of-symlinks-800380/)

PlymWS 04-06-2010 11:29 AM

Using .htaccess instead of symlinks
 
I'm trying to tidy up my server layout a bit. Currently I have several files in the root web directory. I then have an identical website that uses one different file ( a php file ) currently located in a subdirectory.

/
File 1
File 2
File 3
php file

-Sub Directory
-ln -s to File 1
-ln -s to File 2
-ln -s to File 3
-Separate php file

As all the subdirectory does is hold a collection of symlinks to the files in the root directory with the exception of a unique php file I was wondering if I could use a .htaccess file to catch URL requests to the subdirectory and use the files in the root directory with the exception of the unique php file.

bathory 04-06-2010 12:43 PM

Hi,

If I can understand well, what you want to do is to delete the symlinks and anything, except unique.php, gets redirected to a file at docroot with the same name.
If that's correct you can use .htaccess in the /subdir directory
Code:

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/unique.php
RewriteRule ^(.*)  /$1



All times are GMT -5. The time now is 09:28 AM.