Forum Moderators: phranque

Message Too Old, No Replies

How many rewrites is too many?

         

Nutter

5:33 pm on Nov 4, 2005 (gmt 0)

10+ Year Member



I am planning on changing the url structure of my blog to cut out the date and just leave the post name. But, obviously I want to 301 from the old urls (and an even older url setup from when I first installed) to the new urls.

I'm using WordPress, and my .htaccess already has about 50 lines of rewrite rules; so I want to make sure that doing this isn't going over the top with rules since I'll probably have to have 3 sets of rules to catch the possible urls.

Would moving them from .htaccess to httpd.conf help?

moltar

5:56 pm on Nov 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How many is too many? That depends on your server power. It's hard to say. Just test it out and benchmark.

Would moving them from .htaccess to httpd.conf help?

Definetely. Because Apache will process them only one during the boot. Otherwise it has to read .htaccess and process it each time someone request a file.

Nutter

6:23 pm on Nov 4, 2005 (gmt 0)

10+ Year Member



Along the same lines, please check this logic to make sure my thinking is in the right place.

Really old urls set to 301 to new urls
Old urls set to 301 to new urls
Current urls use rewrite rule to the correct format

Only downside I see is that the old urls will be rewritten twice.

Sound right?

moltar

10:14 pm on Nov 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nothing should be redirected more than once. I have no proof, but I'd think that SEs would consider this as a shady area, because many spam sites use multiple redirects.

If you have more than one old URLs, they should all point to a new one. So if you had foo.html, then later renamed it to bar.html and had a redirect foo -> bar. Now you are renaming bar.html to baz.html. So forward both foo.html and bar.html to baz.html and NOT foo -> bar -> baz.

jdMorgan

10:21 pm on Nov 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Without details of the form of the URLs, it's hard to discuss, but if they all follow a pattern, or a few patterns, then it's possible you might only need a few rules to rename all of your entries. The power of regular-expressions is in pattern-matching. Perhaps you can adjust your plan for new URLs to better suit its capabilities, and then use only three or four rules to implement the rewrites and redirects.

Jim

Nutter

3:41 am on Nov 5, 2005 (gmt 0)

10+ Year Member



Moltar - question for you. You mention it possibly being shady to do multiple redirects. Wouldn't having the old url being 301'd to the new url which in turn is mod_rewrite'd to a query string actually be one redirect followed by a rewrite? Does a SE pick up when mod_rewrite is used? I thought it just saw the "friendly" url.

moltar

5:08 am on Nov 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, in that case you are fine. Rewrites cannot be picked up by SEs - only redirects. I thought you were going to have two redirects.