Welcome to WebmasterWorld Guest from 54.146.180.94

Forum Moderators: Ocean10000 & incrediBILL & phranque

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

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

5+ Year Member



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!

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

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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.

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

5+ Year Member



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

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

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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.
8:09 pm on Dec 31, 2009 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



^(.*)
should read
^s/(.*)
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month