Using htaccess i have written to point old domain to new domain . but i need new domain page in old domain url.
The contents in the test.xyz.com has to be shown in old domain.
How can I achieve it ?
RewriteEngine On
RewriteCond %{HTTP_HOST} ^abc\.test\.net$
Redirect 301 / https://test.xyz.com
Related
I want to redirect my old domain urls with new domain with htaccess file.I have tried but it only works in root folder files when I access pages with Subdirectory from old domain it redirects to home page.
so anyone has proper solution?
For e.g.
My old url
www.olddomain.com/dir1/page1.php
Now when user goes to above link it will directly goes to
www.newdomain.com/dir1/page1.php
All you should need to do however is include this in the .htaccess of your old domain:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://new-domain.com/$1 [R=301,L]
For specific directories:
Redirect 301 /mydir http://www.new-domain.com
or if it is to go to another directory:
Redirect 301 /mydir http://www.new-domain.com/mydir
I am looking for a 301 redirect. I have a OC 1.5.1.3 (abc.com) and have a new store now on OC 2.0.3.1 (xyz.com ). I have migrated my data from abc.com to xyz.com and since all the product / pages urls are the same except the domain change, i am looking for a simple code which i can add to htaccess to make this happen.
Since my old website urls are listed on Google, i would like to redirect the traffic coming to a particular url to the same page on the new website. It would be a permanent redirect.
I paid a freelancer to get this done.. was in a hurry. Anyways, i have posted the answer below for the benefit of all.
Upload this to .htaccess on your old domain abc.com, replace example.com with your new domain name.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !example.com/$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
I have an old domain that I have redirected to a new domain, using
RewriteRule ^(.*)$ http://www.newsite.com/$1 [R=301,L]
In reviewing the incoming links to my old site, I found out there are hundreds of spammy links pointing to random sub-domains on my old site. So, my backlink profile has links to things like adfdfdf.oldsite.com , etc.
I don't want these old spammy links forwarded, as they now point to www.newsite.html, thus giving me spammy links to my new site home page.
What I would like is for the oldsite to only redirect the root domain and the www subdomain, but no other subdomains.
I tried a couple of different configurations but couldn't get one to work properly. Any ideas?
Add this condition:
RewriteCond %{HTTP_HOST} ^(www\.)?oldsite.com$ [NC]
right bfore your redirect rule.
I made simple web page at http://www.domain.com/mobile/{rest of url}
and i want to have http://mobile.domain.com/{rest of url}
On other forums, ppl tolde me to move page, unfortunately it's not possible since that page is using other controllers and models from the rest of page and /mobile/ is not folder, it's name of codeigniter controller that is also defined buy some other htaccess rules
I created subdomain mobile dot domain.com and i want to redirect all traffic from it WITH keeping URL in this form: mobile dot domain dot com/{path}
Try adding this to your htaccess:
RewriteCond %{HTTP_HOST} ^mobile.domain.com$ [NC]
RewriteRule ^(.*)$ /mobile/$1 [L]
If you have other rewrite rules in your htaccess file you may want to add this before the other rules.
Let's say I have a domain: A.com, and if someone goes to A.com I want to redirect to B.com.
But if they go to any page on A.com, e.g. A.com/wp-admin/index.php, there will be NO redirect. In short, I just want a simple top level old name to new domain name 301 redirect. (Any specific pages on A.com will be redirected to specific pages on B.com one by one).
Here you go:
RewriteEngine On
RewriteCond %{HTTP_HOST} =domain-one.com
RewriteRule ^$ http://domain-two.com/ [R=301,L]
This rule is to be placed in .htaccess in website root folder. If placed elsewhere some small tweaking may be required.
It will redirect hits to domain root only, e.g. http://domain-one.com/ and no other pages.
I have replaced A.com by domain-one.com and B.com by domain-two.com -- it is more realistic/understandable than A & B.