need help - htaccess - point WP blog posts to forum posts

by Ghalt
5 replies
  • WEB DESIGN
  • |
Hey folks!

I'm hoping you can help me.

I have a blog that gets decent traffic. It was setup in an "ask and answer" format...blog posts are questions and users can leave comments in the answers.

I wanted to change over to a forum, since that's a more natural format for that kind of behavior.

So, right now, though, my blog posts are well-ranked and well-trafficked through search.

I've already migrated my blog posts into the SMF forum.

The structure of my site is thus:

http://mydomain.com - the root is my blog.
http://mydomain.com/this-is-a-post - an example of a blog post URL
http://mydomain.com/forum - this is the root of my forum
http://mydomain.com/forum/forum-category/this-is-a-post - example of forum post URL...and is, in fact, the same content as the blog post

So I'm looking for the right .htaccess redirect rules that would send the blog post to the forum post using a 301. That way eventually the search engines would recognize my forum post as the correct place to land. And users who find my blog posts from search will end up on the forum post.

I'm worried about creating some kind of loop, though, like if I redirect everything after mydomain.com that the forum pages would get stuck in a loop.

Any thoughts?

Many thanks!!
#301 #blog #forum #htaccess #point #posts #redirect
  • Profile picture of the author RobinInTexas
    Originally Posted by Ghalt View Post

    Hey folks!

    I'm hoping you can help me.

    I have a blog that gets decent traffic. It was setup in an "ask and answer" format...blog posts are questions and users can leave comments in the answers.

    I wanted to change over to a forum, since that's a more natural format for that kind of behavior.

    So, right now, though, my blog posts are well-ranked and well-trafficked through search.

    I've already migrated my blog posts into the SMF forum.

    The structure of my site is thus:

    http://mydomain.com - the root is my blog.
    http://mydomain.com/this-is-a-post - an example of a blog post URL
    http://mydomain.com/forum - this is the root of my forum
    http://mydomain.com/forum/forum-category/this-is-a-post - example of forum post URL...and is, in fact, the same content as the blog post

    So I'm looking for the right .htaccess redirect rules that would send the blog post to the forum post using a 301. That way eventually the search engines would recognize my forum post as the correct place to land. And users who find my blog posts from search will end up on the forum post.

    I'm worried about creating some kind of loop, though, like if I redirect everything after mydomain.com that the forum pages would get stuck in a loop.

    Any thoughts?

    Many thanks!!
    Using a generalized htaccess breaks down when you add forum-category/this-is-a-post

    I think you are going to add the redirects one at a time.

    The WordPress Redirection plugin might make it easier, furthermore, it will track any hits to the old WordPress if
    you still have that installation available.

    You could create a PHP 404 type page for the old site that searches the forum and offers suggestions or perhaps even redirects to the forum.
    Signature

    Robin



    ...Even if you're on the right track, you'll get run over if you just set there.
    {{ DiscussionBoard.errors[9007029].message }}
  • Profile picture of the author Ghalt
    Sorry...does it help that there is only one forum-category?

    So there is no need for intelligent rules about finding the right category. It would need to redirect to:

    mydomain.com/subdir1/subdir2/post-title

    Does that make better sense?
    Signature
    Got eBook?

    Save money - make your eBook Cover yourself with free software (GIMP), and our detailed guide: http://www.makeebookcovers.com
    {{ DiscussionBoard.errors[9007101].message }}
    • Profile picture of the author RobinInTexas
      Code:
      RedirectMatch 301  http://www.mydomain.com/(.*)  http://www.mydomain.com/forum/forum-category/$1
      Should do it.
      Signature

      Robin



      ...Even if you're on the right track, you'll get run over if you just set there.
      {{ DiscussionBoard.errors[9007245].message }}
      • Profile picture of the author Ghalt
        Thanks, RobininTexas -

        But one question. Will existing forum posts that also reside on:

        mydomain.com/forum/forum-category/this-is-another-post


        ...won't create some kind of redirect loop with that htaccess command?
        Signature
        Got eBook?

        Save money - make your eBook Cover yourself with free software (GIMP), and our detailed guide: http://www.makeebookcovers.com
        {{ DiscussionBoard.errors[9009215].message }}
      • Profile picture of the author SJL
        Originally Posted by RobinInTexas View Post

        Code:
        RedirectMatch 301  http://www.mydomain.com/(.*)  http://www.mydomain.com/forum/forum-category/$1
        Should do it.
        Actually no. Because for example
        Code:
        http://www.mydomain.com/logo.jpg
        would then be redirected to
        Code:
        http://www.mydomain.com/forum/forum-category/logo.jpg
        I would post the the solution here, but this forum doesn't handle php correctly.
        Anyway php-code you need is at http://pastebin.com/hzn3jen2
        You will need to save it as single.php, change the "forum-category" on line 3 to match your actual forum category name and upload it to your WP themes folder.
        ( for example wp-content/themes/my-sites-theme/ )
        {{ DiscussionBoard.errors[9010844].message }}

Trending Topics