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.

Redirecting old URL's to new URL's

May 22, 2008 11:19am

Subscribe [2]
  • #1 / May 22, 2008 11:19am

    aftershock

    46 posts

    I am redesigning my personal site and I plan on making a fundamental change to the URL structure to better fit with new content. I don’t have that many posts ( < 5 !) so the change would be ok. However I get a lot of traffic to one particular post and I don’t want to loose that.

    Basically I have http://jameswhittaker.com/blog/article-title and I wish to change that to http://jameswhittaker.com/notebook/article-title

    I would like to forward all traffic heading for /blog/ to /notebook/. i understand this can be done using .htaccess but I don’t have a clue!

    I also have complete root access to the server so would this be better done at the apache config file?

    I’m looking for advice or any good links to point me in the right direction.

    Thanks all.

  • #2 / May 22, 2008 12:03pm

    Greg Aker

    6022 posts

    Aftershock:

    In a .htaccess file that resides in the same folder as the main index.php, you need to do:

    redirect 301 /blog/article-title <a href="http://www.example.com/notebook/article-title">http://www.example.com/notebook/article-title</a>

    You can get a little crazier with modrewrite, but I’m by no means an expert with that, so I don’t want to give false info.

    Hope that helps,

    -greg

  • #3 / May 22, 2008 12:07pm

    aftershock

    46 posts

    Thanks

    I don’t suppose anyone knows the syntax for re-driecting a whole directory?

    Example /blog/ to /notebook/?

  • #4 / May 22, 2008 12:14pm

    Greg Aker

    6022 posts

    This should be a good starting point:

    http://www.webmasterworld.com/apache/3431085.htm
    http://www.google.com/search?hl=en&q=folder+redirect+in+apache&btnG=Search

    But, like I said before, i’m not good with rewrites like that, but that first link is definitely worth a shot.  If you get a 500 error, you can always just delete the .htaccess file.  =)

    -greg

    Thanks

    I don’t suppose anyone knows the syntax for re-driecting a whole directory?

    Example /blog/ to /notebook/?

  • #5 / May 22, 2008 12:21pm

    Ingmar

    29245 posts

    I don’t suppose anyone knows the syntax for re-driecting a whole directory?

    Example /blog/ to /notebook/?

    Try this:

    redirect 301 /blog/(.*) <a href="http://www.example.com/notebook/$1">http://www.example.com/notebook/$1</a>

    If that doesn’t work, you actually need to read up on it, I am afraid.

    ETA: Does redirect even support regexes? Just try it.

  • #6 / May 22, 2008 1:20pm

    aftershock

    46 posts

    Thanks for the input guys, I’ll try them out on my test server and report back. 😊

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

ExpressionEngine News!

#eecms, #events, #releases