homepage Welcome to WebmasterWorld Guest from 54.198.224.121
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Website
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
is root level .htaccess w/ 50 redirects using too much cpu?
doob




msg:4051267
 8:04 am on Dec 30, 2009 (gmt 0)

I have a shared hosting account with godaddy hosting several sites including one that is predominantly a dynamic forums site.

I recently received word from them that my account was using too much cpu on the server, but its almost impossible for me to troubleshoot.

Some recent changes I made were an increase in advertising which has resulted in a usage spike and editing the root level .htaccess to include 50 new redirects.

I obviously realize the cpu usage could relate to many things, but I'm trying to rule out the .htaccess scheme as the culprit.

I'm writing redirects that look like:

redirect 301 website.com/shortAddy [website.com...]

I figured it would be easier to edit redirects in a single centralized location at the root. There is no such directory as "shortAddy", I'm just trying to simplify some url based shortcuts to particular forum sections.

Is my approach clobbering the server or is it safe? Would it be more optimal for me to create a directory called website.com/shortAddy and put a .htaccess or a php page with a 301 redirect in that? Its somewhat more work but feasible.

Thanks!

 

g1smd




msg:4051275
 8:31 am on Dec 30, 2009 (gmt 0)

Even if the list were quite long it is unlikely to slow the server down that much.

However if you could use a short address like /s/nnn where nnn is the number you want to carry over, you could do this in a single line of code (using RewriteRule instead of Redirect) for all of the redirects.

Even better would be to use a rewrite, so that users continue to see the shorter URL, not be redirected to the long one.

doob




msg:4051724
 10:55 pm on Dec 30, 2009 (gmt 0)

One line of code sounds good to me! I'm not sure I understand how I could do that based on what I'm reading in the apache docs.

I'm redirecting /a to ?f=3, /b to ?f=6, /c to ?f=7, /d to ?f=9, /e to ?f=12 and so on. I'm not directing 50 /dirNames to just 1 forum id. I'm directing 50 directing 50 /dirNames to 50 unique forum id's.

Or are you just saying one line of code per rewrite rule?

thanks
D

g1smd




msg:4051930
 8:16 am on Dec 31, 2009 (gmt 0)

If the information for the rewrite is not contained in the URL request, then one line of code isn't possible.

It would be possible if the URL /s/[b]3[/b] matched the internal path /index.php?f=[b]3[/b].

It is important that the URL either contains something unique (the /s/ bit), or is always digits /[i]<nnn>[/i] so that a simple pattern like ^(.*) or ^([0-9]{1,3}) can match those requests.

g1smd




msg:4052311
 8:09 pm on Dec 31, 2009 (gmt 0)

^(.*) should read ^s/(.*)
Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved