Forum Moderators: phranque

Message Too Old, No Replies

.htaccess file size limit

how big is too big?

         

sun818

11:48 pm on Oct 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I read this thread on .htaccess [webmasterworld.com] file size limits. I don't have a good feeling with what I want to do, but I wanted additional feedback from y'all. I want to shorten all my URLs from keyword rich ("blue-widget.htm") to product id ("13.htm"). But that means I need to redirect all 700 products to the correct file.

Should I wait until the holidays are over? Are the redirects going to bog the web server down? (I'm on a shared host.) Are there alternatives to .htaccess that will not be as harsh? Is the order in which I place redirect significant? For example, product 288 is more popular than product 13, so would putting 288 first in the .htaccess file be more efficient?

DrDoc

12:31 am on Oct 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could always handle all redirects in a script... Just redirect all requests to that script, and have the script display the appropriate information. I assume the pages are all dynamic anyway, right?

sun818

2:03 am on Oct 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



No, they are actually static html files that I publish from my computer and upload to the web site. Yeah, I know... its crude, but I never get complaints about a slow web site. :)

jdMorgan

4:02 am on Oct 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sun818,

> Should I wait until the holidays are over?

That depends on why you want to do this.

> Are the redirects going to bog the web server down? (I'm on a shared host.)

Probably not, if done efficiently.

> Are there alternatives to .htaccess that will not be as harsh?

Depends on how (or whether) you associate old URLs with product numbers.

> Is the order in which I place redirect significant? For example, product 288 is more popular than product 13, so would putting 288 first in the .htaccess file be more efficient?

Yes, if you go for a simple 1:1 replacement, rather than an associative replacement.

...Better get on with that... I'd recommend you make a rule for translating old URLs to new URLs - if possible.

For example, if Blue = 3 and Widget = 1, then product Widget,Blue would naturally be product 13, and if Red was 1 and Green was 2, then products 11 and 12 are defined by the same rule.

The advantage of this is that it greatly reduces the total number of URL rewrites you have to do. You could use a stepwise rewrite, using one rule to rewrite the "1" to "Widget/" and a following rule to rewrite the color code. Using two stepped rules would allow you to greatly reduce the total number of rules required.

If this is not possible, then a straight list of replacements, ordered most- to- least-popular would work. Just make sure you use the [L] flag of RewriteRule to stop processing as soon as a match is found.

Jim

sun818

6:13 am on Oct 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi Jim, congrats on being moderator.

> That depends on why you want to do this.

I am thinking a shorter URL is more practical and looks cleaner. I can actually look up a product by typing in the URL instead of navigating to it for a change. And since WW organizes the forum posts with short URLs, why not? :) There has to be good reason why this forum is displayed as webmasterworld.com/forum92.htm instead of webmasterworld.com/apache-web-server.htm?

> replacements, ordered most- to- least-popular would work

That is the plan:

Redirect 301 /buy-my-widget.htm http://example.com/288.htm
Redirect 301 /keyword-rich-url.htm http://example.com/13.htm

I assume I do not put a [L] at the end of these straight lists, as all the examples I've reviewed do not have them.

[edited by: jdMorgan at 1:47 am (utc) on Nov. 1, 2003]
[edit reason] Neutralized URLs [/edit]

jdMorgan

2:49 pm on Oct 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sun818,

You wrote:

Redirect 301 /buy-my-widget.htm http://example.com/288.htm
Redirect 301 /keyword-rich-url.htm http://example.com/13.htm

I assume I do not put a [L] at the end of these straight lists, as all the examples I've reviewed do not have them.

You'd only use [L] if you used mod_rewrite's RewriteRule to implement the redirect:


RewriteRule ^buy-my-widget\.htm$ http://example.com/288.htm [R=301,L]
RewriteRule ^keyword-rich-url\.htm$ http://example.com/13.htm [R=301,L]

mod_rewrite or a scripted solution will be more useful if there is any association between your old and new URLs that can be used to make the mapping of old to new URLs simpler. They also offer the possibility of making the process more efficient; Basically, Redirect in mod_alias has no ability to handle conditional processing, mod_rewrite has significant capability, and a script offers unlimited capability to handle conditional processing... So, for example, you can add a line to the mod_rewrite or script code to skip the whole block of code for any files except those that end in ".htm" -- and make a big difference in performance when serving images and scripts.

Jim

[edited by: jdMorgan at 1:49 am (utc) on Nov. 1, 2003]

sun818

3:06 pm on Oct 31, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi jd, there is no logical scheme for the URL (like a change of directory). I understand what you're saying about RewriteRule. I will update my .htaccess so the Redirect 301 uses the RewriteRule instead. I learned something new today. Thanks!

keyplyr

1:16 am on Nov 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



BTW...

how big is too big?

was never answered. Is there a file size that tips the scale?

jdMorgan

1:53 am on Nov 1, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



keyplyr,

That would depend entirely on how busy your server is.

Mine range up to 25kB, though I like to keep them under 20kB.

Jim