Well dear i am not familiar with code and structure of .htaccess file. please can you make it for me?
It’ll depend on what web server your old site is using, but the easiest way to find out is to create a file:
.htaccess
and put it in the root of your web directory (on your old server).
Just add this one line (replacing “new-site” with the domain of your actual new site):
Redirect 301 / http://www.new-site.com/
You can FTP the file up to your old server if need be, but check if your old server already has an .htaccess file (since it starts with a dot, it might be hidden from view).
i already have .htaccess file on old, so i place this code into that. Will this also redirect myolddomain.com/mypage.html to mynewdomain.com/mypage.html too? if i have same content and same permalink structure?
No, but you should be able to use this (to the top of .htaccess file) if the page names and directory structure are identical, with the only difference being the domain name:
RewriteEngine On
# Redirect Entire Site to New Domain
RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR]
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]
No its still only redirecting to homepage of new domain instead of same page.
Both sites are on same hosting.
Did you remove this line?
Redirect 301 / http://www.new-site.com/
i have just copy and pasted your given code on top of my .htaccess file nothing else.
This line is not available Redirect 301 / http://www.new-site.com/
ok, i tried to do it using cpanel, its redirecting pages to but getting 404 error for posts/pages, on old site permalinks were /mypostpermailink/ and on new site permalinks are /mypostpermalink.html
Any suggestion how to solve this?
still looking for solution?