The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Filesystems, Disks and Memory
Google UNIX.COM
Home Forums Register Rules & FAQ Members List Arcade Search Today's Posts Mark Forums Read


Filesystems, Disks and Memory Questions involving NAS, SAN, RAID, Robotic Libraries, backups, etc go here.


Other UNIX.COM Threads You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Symlinks ct1977 UNIX for Dummies Questions & Answers 1 02-21-2008 02:15 PM
Nested Symlinks? deckard Shell Programming and Scripting 0 09-07-2007 12:07 PM
search and replace symlinks nixrock UNIX for Advanced & Expert Users 2 10-19-2005 02:25 PM
.htaccess Avenger UNIX for Dummies Questions & Answers 3 04-12-2002 08:49 AM
.htaccess? Puc conDoin UNIX for Dummies Questions & Answers 1 05-28-2001 05:58 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-27-2007
Registered User
 

Join Date: Sep 2007
Posts: 19
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
.htaccess and symlinks

We give all of our members a free website, that is in this format:

http://www.mydomain.com/members/USER.../myfriend.html

But to make it easy on them we let them have a redirect to that this way:
http://www.mydomain.com/USERNAMEHERE
which redirects them to the address above.

We use .htaccess for that.
the problem is that we just opened our doors and are already over 5k members, we anticipate before the end of the year we will have closer to 100k members! That would be one HUGE .htaccess file.

Is there a better way to redirect them, possibly with symlinks?
/members is a perl script that I got to execute, which reads the first word after the / to be their username and checks if it is valid, so whatever I do, I have to keep /members as part of the URL, which symlinks could do, I think.

So would it bet better to have 250,000 symlinks or 250,000 lines of:
Redirect /USERNAMEHERE http://www.mydomain.com/members/USER.../somepage.html
which would make one LARGE .htaccess file.

I would like to thank you in advance for any kind assistance or advice you can offer for us.

Thank you.
Richard
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 09-27-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,205
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
I doubt that symlinks would work at all in this case since they would not be pointing to a filesystem object. But in any case, 250,000 directory entries of any kind is a guaranteed performance disaster. The kernel processes directories sequentially. The large file would probably win. And if there is a problem, there is more hope of optimizing the file access since that would involve changing only one program.
Reply With Quote
  #3 (permalink)  
Old 09-27-2007
Registered User
 

Join Date: Sep 2007
Posts: 19
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
So what is the best way to do this then?
Is there a way to make a particular domain, say a parked domain, that every /FirstPath run a script so I can check if it is username?

Or is there a way Unix can check in the httpd.conf file to see if the directory they entered exists, then take them there, otherwise send them to my script not just a 404.html but maintaining the directory it cannot find:

for example:
http://www.mydomain.com/foo

doesnt exists so redirect:
http://www.mydomain.com/foo/errorfile.whatever

I don't know. There has to be a way to do it to where an unlimited amount of people can access this and we not have to worry about performance. we already setup load balancing so we can add an unlimited amount of server space as the need arises, with 2 simple lines of code...

Any ideas?
thank you very much for your response.
Reply With Quote
  #4 (permalink)  
Old 09-27-2007
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,312
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
Simply use mod_rewite to rewrite and/or redirect the URLs, and inclue the rewrite rules in the apache config file instead of using .htaccess. The performance of using .htaccess for this is very sub-optimal.

Also consider load balancing based on username so that you don't create a silly number of subdirectories, as Perderabo said, your current structure is not at all scalable.
Reply With Quote
  #5 (permalink)  
Old 09-27-2007
Registered User
 

Join Date: Sep 2007
Posts: 19
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiReddit! Stumble this Post!Spurl this Post!
where can I learn about 'mod_rewite', I did an advance search on this forum for it in all fourms and it only pulled up this thread

thank you.
Richard
Reply With Quote
Google UNIX.COM
Reply



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 03:03 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger

Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102