+ Reply to Thread
Results 1 to 4 of 4

 

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

  1. #1
    renegade's Avatar
    Moderator

    Status
    Offline
    Join Date
    Aug 2003
    Posts
    3,526
    Thanks
    289
    Thanked 138 Times in 58 Posts


    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
    Ian Ebbs

    Status
    Offline
    Join Date
    Aug 2003
    Location
    England
    Posts
    1,096
    Thanks
    5
    Thanked 6 Times in 2 Posts
    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
    Ian Ebbs

    Status
    Offline
    Join Date
    Aug 2003
    Location
    England
    Posts
    1,096
    Thanks
    5
    Thanked 6 Times in 2 Posts
    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's Avatar
    Moderator

    Status
    Offline
    Join Date
    Aug 2003
    Posts
    3,526
    Thanks
    289
    Thanked 138 Times in 58 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]

+ Reply to Thread


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

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
To Top

Content Relevant URLs by vBSEO 3.5.0 RC2