Forum Moderators: phranque
I'm having a problem trying to redirect a domain.
My current domain is place at www.old-site.com/blog
and I would like to move it to www.new-site.com
but remember, just the /blog part, the main site stays where it is.
I've tried 2 different methods, one works, the other doesn't
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.old-site.com/blog [NC]
RewriteRule ^(.*)$ http://www.new-site.com/$1 [L,R=301]
it doesn't work. I placed this in the .htaccess found in the root, and not under the /blog
but if I try this code
redirect 301 /blog http://www.new-site.com/
everything works well.
Which one should I use? Is there a difference between the two of them?
Also, since most of my traffic is from Google, I read somewhere that it's a good idea to redirect the pages one by one, but..I have no idea on how to proceed with that.
Thank you
RewriteEngine on
#
RewriteCond %{HTTP_HOST} ^(www\.)?old-site\.com [NC]
RewriteRule ^blog(.*)$ http://www.new-site.com$1 [R=301,L]
Note that the pages on the new site may need to be modified to link to www.new-site.com/<page>, and not to www.new-site.com/blog/<page>.
Jim
Here is the full scenario:
On my hosted server, I have several website setup. So, basically, public_html is the root, which contains of course the main website and other sites as well, setup this way: site1, site2, etc...
Now, the /blog is obviously found under public_html/blog , which translates to www.old-site.com/blog
The public_html has an .htaccess which is basically empty. The /blog folder, since it's a Wordpress installation, it has it's only .htaccess.
Before we go into the above code that wasn't working, here is what I did so far:
1. I put redirect 301 /blog http://www.newsite.com into the .htaccess in the public_html. By doing that, the old-site.com/blog redirects fine to the new one, but...now the /blog found under a different site, like site1.com/blog redirects also to the new-site.com, which is not something that I want.
2. to avoid all of this, I took the redirect 301 code from the .htaccess in the public_html and I have placed inside the .htaccess found in the public_html/blog, or old-site.com/blog. Now, the redirect works fine and just for that domain.
Now to go further, I am not sure how to do the redirect in the way you explain it in your post, so if you could please help me out with that, I would really appreciate it.
I am beyond desperate now since my Google traffic accounts for 80% of the overall traffic.
[edited by: tedster at 1:09 am (utc) on Feb. 22, 2008]
[edit reason] de-link [/edit]
On my hosted server, I have several website setup. So, basically, public_html is the root, which contains of course the main website and other sites as well, setup this way: site1, site2, etc...
[edited by: Marcia at 11:59 pm (utc) on Feb. 21, 2008]
Also, this is exactly why I've gone with multi-domain WHM hosting where each domain has its own /cpanel and /www (and their own stats) and have stayed clear of add-on domains, where additional domains go into sub-folders of the main account domain. I wouldn't know where to begin with add-ons.
Could there be any conflict between what you're putting into mod_rewrite in the root and the WP .htaccess that's in the /blog folder?
<snip>
So, basically, the one that I am worry about is public_html/blog.
What I was trying to say about site1/blog was that if I place the redirect 301 /blog [new-domain.com...] in the .htaccess found in the public_html, then it would redirect both, the public_html/blog and site1/blog
To avoid this, I placed the redirect 301 code in the public_html/blog/.htaccess and this was, only that folder gets redirected.
[edited by: jdMorgan at 5:18 pm (utc) on Feb. 22, 2008]
[edit reason] No URLs, please. See Terms of Service. [/edit]
the weirdest part is that any mod_rewrite that i tried in the public_html/.htaccess doesn't work, and yes, mod_rewrite is enabled, I tested it.
you said this in an earlier reply
"Note that the pages on the new site may need to be modified to link to www.new-site.com/<page>, and not to www.new-site.com/blog/<page>."
I don't think they need to be modified since i kept the same permalink structure in Wordpress, so instead of having the domain abc.com/blog/ now I have xyz.com so the <page> makes no difference in the end.
OK, then let me be clear. It is one of three correct solutions, and will not cause problems unless you've not told us some important detail, or mis-typed it. CHanck your server headers thoroughly, and then stop owrrying about it.
> I don't think they need to be modified since i kept the same permalink structure in Wordpress, so instead of having the domain abc.com/blog/ now I have xyz.com so the <page> makes no difference in the end.
I'm not sure what you mean by this (at several levels, but it's irrelevant), but if WP takes care of this by default and you see newdomain.com/ instead of olddomain.com/blog when you hover over a link, then you're OK. If you *do* see olddomain.com/blog when hovering, then it *will* make a difference in the end.
Jim
but here is the issue. A few days ago, there were about 200 links out of 900 that were indexed by google already, then 2 nights ago, it dropped to like 130 links, it went back up during the day yesterday, maybe 160, and now it's down again to 100. Is this normal?