LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 04-06-2010, 11:29 AM   #1
PlymWS
Member
 
Registered: Aug 2006
Posts: 51

Rep: Reputation: 16
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.
 
Old 04-06-2010, 12:43 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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

Last edited by bathory; 04-06-2010 at 12:51 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Symlinks and .. smidgie82 Linux - General 2 12-21-2005 04:13 PM
? on symlinks eroica Linux - Software 1 09-21-2004 09:45 AM
symlinks.. NSKL Slackware 3 05-26-2002 05:35 PM
Symlinks b0b0 Linux - General 2 11-08-2001 08:43 AM
symlinks tstuhr Linux - General 3 10-05-2001 10:49 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration