1. #1
    renegade renegade renegade's Avatar Moderator
    Join Date
    Aug 2003
    Posts
    3,509
    Thanks
    280
    Thanked 129 Times in 53 Posts

    301 redirect from old blog location to new blog location...

    I've moved my blog and would like to inform search engines and spiders to find the new blog and pass the PR from the old pages to the new pages.
    AIUI I need to create an .htaccess file in the domain root which I have done, it doesn't work (i.e. if I enter an old URL it displays the old page (which still exists) and does not redirect to new page).
    The .htaccess file contains:

    ---
    Options +FollowSymlinks
    RewriteEngine on
    rewritecond %{http_host} ^cantbarsed.com/blog/ [nc]
    rewriterule ^(.*)$ http://blog.cantbarsed.com/$1 [r=301,nc]
    ---

    Do I need to remove the old pages before it will work or is the code wrong?
    Any help gratefully received.

  2. #2
    Kandevil is an unknown quantity at this point Ian Ebbs
    Join Date
    Aug 2003
    Location
    England
    Posts
    1,095
    Thanks
    1
    Thanked 2 Times in 1 Post
    Quote Originally Posted by renegade View Post
    Do I need to remove the old pages before it will work or is the code wrong?
    Hope the tan isn't fading too fast Joe. You don't need to remove the old pages, if it is correct it will happen if they are there or not. I'll have a look at the code soon, if somebody doesn't beat me to it.

    affiliates4u Fantasy Football Winner 2007/08

  3. #3
    Kandevil is an unknown quantity at this point Ian Ebbs
    Join Date
    Aug 2003
    Location
    England
    Posts
    1,095
    Thanks
    1
    Thanked 2 Times in 1 Post
    there are prettier ways of doing it, but this should work:

    Code:
    RewriteEngine On
    Redirect 301 /blog http://blog.cantbarsed.com
    RedirectMatch 301 ^/blog/(.*)$ http://blog.cantbarsed.com/$1
    that needs to go in your root's .htaccess file

    affiliates4u Fantasy Football Winner 2007/08

  4. #4
    renegade renegade renegade's Avatar Moderator
    Join Date
    Aug 2003
    Posts
    3,509
    Thanks
    280
    Thanked 129 Times in 53 Posts
    Thanks for that Ian, much appreciated.
    It needed a bit of further tweaking (my programmer mate took a look - he fell down the stairs over the weekend and is just out of hospital - I think he's still a bit "punchy" because I'm not convinced it's 100% sorted but it's doing something):
    Code:
    RewriteEngine On
    Redirect 301 /blog http://blog.cantbarsed.com
    #RedirectMatch 301 ^/blog/(.htm)$ http://blog.cantbarsed.com/$1.html
    RewriteRule ^blog/(.+)\.htm$ http://blog.cantbarsed.com/$1.html [R=301,NC]

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. How to Create Your First Blog
    By Banner-Traffic in forum Media Coverage & PR Strategy
    Replies: 11
    Last Post: 28-03-07, 06:20 PM
  2. Test Your Blog
    By freetraff in forum Google SEO
    Replies: 2
    Last Post: 27-08-05, 12:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Content Relevant URLs by vBSEO 3.5.0 RC2