[resolved] Redirect homepage to a category (13 posts)

  1. visionquest
    Posted 9 years ago #

    Hi my wordpress mainpage is in my domains root directory, so when i go to http://www.mydomain.com i see my main wordpress page.

    HOWEVER, when someone types http://www.domain.com I want it to be redirected to http://www.domain.com/category/name

    How can this be achieved quickly and reliably?

    (p.s. im using permalinks)

  2. chaaban
    Posted 9 years ago #

    it's bad to do this ... but you can do it simply by adding this line in your header page :

    <meta http-equiv="refresh" content="0; url=Your-new-url-here">

  3. visionquest
    Posted 9 years ago #

    Okay, that redirects to the correct page but it keeps refreshing, over and over again.

    How can it go to the page without refreshing?

  4. estjohn
    Posted 9 years ago #

    add a " after the 0

    <meta http-equiv="refresh" content="0"; url=Your-new-url-here">

  5. visionquest
    Posted 9 years ago #

    Unfortunately, adding the " after the O didnt help. It just refreshed the main page over and over again.

    At least the first solution got to the redirected page but kept refreshing.

    Just wannna get to the redirected page and stay still.

    Any ideas?

  6. moshu
    Posted 9 years ago #

    That's not O... it is is zero [0]

  7. chaaban
    Posted 9 years ago #

  8. moshu
    Posted 9 years ago #

    See also other solutions:
    (you want a permanent redirect = 301; otherwise the search engines might punish you)

  9. chaaban
    Posted 9 years ago #

    i know why it keep refreshing :)

    because the code is the header and the header is used in both the main page and category so it keep requesting for a refresh ...

    my code was correct , some minor modification should be made to fix this issue ...

  10. chaaban
    Posted 9 years ago #

    this should work :

    echo "<meta http-equiv="refresh" content="0; url=http://your-url/">";

    it work fine on IE && FF

    The only problem i see is that Search engine might not like this ... as i mentioned in my first post and as moshu mentioned ...

  11. visionquest
    Posted 9 years ago #

    Thanks Chaaban for your help! Your code was correct, and the error was as you indicated.

    Incidentally, the reason I wanted to bypass the main page was because it showed the latest posts from different Parents, and I just wanted the posts from 1 parent displayed. So I redirected directly to the category.

    I'm sure there are other ways to achieve this that do not run afoul of google's rules, but for now, this works. I will promote the site using the category name (longer url). So maybe the longer url will be indexed instead of the just the domain. Sorry for the long post. Newb' to WP.

  12. moshu
    Posted 9 years ago #

    You are over-complicating it :)
    1. Use a plugin to exclude categories to be shown on the main page:
    2. No need for redirect
    3. The excluded posts will be shown only on their category pages.

    You should always described what you want to achieve, instead of thinking you know how to get the desired result and asking confusing "technical" questions :)
    You approach just doesn't make sense, so this this should be a good lesson: describe what you want and many helpers will offer good and easy solutions.

  13. visionquest
    Posted 9 years ago #

    Thanks Moshu. I appreciate your feedback. I was doing this for a friend and was told by her that she didnt get the answer, so I embarked on finding my own. I implemented the plugin you suggested and it worked perfectly. Thank you and the other respondents.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.