Hi, We have two domains - abc.com and xyz.com abc.com is a domain that we started off with. But now the main domain is xyz.com Our site administrators have mapped both the domains to the same ip address. So essentially there is only one folder which has all the files pertaining to the website. If anyone types in abc.com they go to the same website as xyz.com. abc.com and xyz.com are the same. The only problem is that abc.com does not resolve into xyz.com on the address bar.Therefore the search results are still reflecting abc.com in their index.xyz.com is not receiving any listings in search engines. I know that I have to implement .htaccess, but I do not have two separate directories for the sites. So if i want a 301 redirect for abc.com, where do I place the .htaccess file? I do not want to remove the earlier domain completely as it has a lot of valuable back links. We have an apache web server. Any help on this would be greatly appreciated. Thanks so much. Best regards RJ
Add a .htaccess file with the following code in your xyz.com root folder. It will solve your problem. RewriteEngine On RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\.xyz\.com [NC] RewriteRule (.*) http://www.xyz.com$1 [R=301,L] Code (markup):
Hi, It does not seem to be working Could it be becasue there are other domains also mapped to the same ip? There are about 4 product sites and the product domains are mapped to the the same IP. There is a java redirect in the directory which redirects that particular domain to a specific folder within the directory. abc.com and xyz.com are redirected to the another such specific folder within the directory. What I wanted was that when people type in "http://www.abc.com" the address bar automatically resolves to "http://www.xyz.com" using a 301 redirect' cause this method seems to be the most accepted method of redirect. Also, "http://www.abc.com" features in search results, whereas "http://www.xyz.com" does not. I guess since both the domains are reflecting the same content, search engines are giving more value to one domain. We want "http://www.xyz.com" to feature in the search results. Is there any way out? Thanks. Best regards Ranjana
All the code above does is redirects to the same URL!! RewriteEngine On RewriteCond %{HTTP_HOST} . RewriteCond %{HTTP_HOST} !^www\.abc\.com [NC] RewriteRule (.*) http://www.xyz.com$1 [R=301,L] or abc.com/.htaccess Options +FollowSymLinks +Indexes RewriteEngine on RewriteBase / RewriteRule ^(.*)$ http://www.xyz.com/$1/ [R=301,L]
Do I need to delete everything from the website and keep just the htaccess file ? What happens when someone will try to reach the old domain ? Thanks in advance, Guy.