visionquest
Member
Posted 5 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)
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">
visionquest
Member
Posted 5 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?
add a " after the 0
<meta http-equiv="refresh" content="0"; url=Your-new-url-here">
visionquest
Member
Posted 5 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?
That's not O... it is is zero [0]
See also other solutions:
http://www.somacon.com/p145.php
(you want a permanent redirect = 301; otherwise the search engines might punish you)
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 ...
this should work :
<?php
if(is_home()){
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 ...
visionquest
Member
Posted 5 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.
You are over-complicating it :)
1. Use a plugin to exclude categories to be shown on the main page:
http://ryowebsite.com/?p=46
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.
visionquest
Member
Posted 5 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.