![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | 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. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Symlinks | ct1977 | UNIX for Dummies Questions & Answers | 1 | 02-21-2008 03: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 |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
.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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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.
|
|
#3
|
|||
|
|||
|
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. |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
||||
|
||||
|
#7
|
|||
|
|||
|
Ok, I read all the documentation, and I thought I had a pretty good grasp on it, but apparently not... Can you tell me what I did wrong here:
Code:
# Turn on Rewrite
RewriteEngine on
# Set the base to /members off the main domain...
RewriteBase /members/
# Ok if the script_filename in %ENV is NOT a valid file
RewriteRule !%{SCRIPT_FILENAME} [F]
# AND if it does not already have /members
RewriteRule !%{SCRIPT_FILENAME} ^/members/
# Then go ahead and add /members to the path they are on so it works, but don't use standard redirect just do it seamlessly... AND /members already has starting / don't redo-it
RewriteRule ^/(.+[^/])$ $1/
Can you tell me what I did wrong? I'd greatly appreciate it. Richard Last edited by reborg; 09-27-2007 at 08:12 AM. Reason: code tags |
|||
| Google The UNIX and Linux Forums |