ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

.htaccess 301 Redirect for 1000+ entries

January 27, 2009 8:39am

Subscribe [4]
  • #1 / Jan 27, 2009 8:39am

    Mason Kessinger

    15 posts

    All,

    I have recently made the big shift from Movable Type to EE on a project and wanted to clean house and give my posts a shiny new URL structure. In the process I now have about 1000+ links across the web, to the old structure, that are invalid. So I am using my .htaccess to manually redirect all links. I am using the following method to create my redirects:

    redirect 301 /old/url/year/month/blah-blah.php <a href="http://www.domain.com/new-cleaner-url/">http://www.domain.com/new-cleaner-url/</a>

    It works when there is just ONE redirect in the .htaccess but when I start adding more it gives me 500s. I have read numerous places where I’m supposed to be able to do this:

    redirect 301 /section/year/month/blah-blah.php <a href="http://www.domain.com/section/blah-blah/">http://www.domain.com/section/blah-blah/</a>
    redirect 301 /section/year/month/boo-hoo.php <a href="http://www.domain.com/section/boo-hoo/">http://www.domain.com/section/boo-hoo/</a>
    redirect 301 /section/year/month/oh-my-oh-my.php <a href="http://www.domain.com/section/oh-my-oh-my/">http://www.domain.com/section/oh-my-oh-my/</a>
    redirect 301 /section/year/month/mercy-me.php <a href="http://www.domain.com/section/mercy-me/">http://www.domain.com/section/mercy-me/</a>

    I’m no expert in this area so I wonder if I’m making an obvious mistake here. Also, is it dumb of me to assume that 1000+ of these in my .htaccess will not slow down my system? Is there a better/faster/more permanent way?

    Also: I also do not think it is going to be a way to use any regular expressions within the .htaccess as the url structures are too varied to support anything like this… If i had it all to do over again I might have rethought this… as it stands i can’t see a way around 1000+ explicit links to the old posts.

    Thanks!!!

  • #2 / Jan 27, 2009 9:18am

    silenz

    1651 posts

    Multiple entries should work…  Are you uploading the .htaccess by FTP? Do you transfer it ASCII mode?

  • #3 / Jan 27, 2009 9:52am

    Mason Kessinger

    15 posts

    tried re-uploading and it worked! Small things sometimes…

    I wonder if you have any insight whether 1000+ of these entries will have any noticable effect on users interacting with the site. Will it slow anything down?

  • #4 / Jan 27, 2009 10:07am

    silenz

    1651 posts

    Never tried it with that many.

  • #5 / Jan 27, 2009 10:31am

    Ryan Irelan

    444 posts

    tried re-uploading and it worked! Small things sometimes…

    I wonder if you have any insight whether 1000+ of these entries will have any noticable effect on users interacting with the site. Will it slow anything down?

    It might, depending on the site load and hardware. Apache loads the .htaccess file on every request. The larger the file, the more load it puts on Apache. I think you’ll be OK with 1,000 lines, but it’s something to keep in mind.

  • #6 / Jan 27, 2009 10:44am

    Mason Kessinger

    15 posts

    This is exactly the type of info I was hoping for.

    Thanks Ryan!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases