Hi! I urgently need help to fix a problem with my 301 redirection using a .htaccess file.. I recently bought a new domain and I can't get my old site to redirect to the new one. What I need to do is that I need to redirect permanently: http://myoldsite(dot)com to http://mynewsite(dot)com http://myoldsite(dot)com/oldpagename.html to http://mynewsite(dot)com/newpagename.html (same content though just changing the page name) So what I need to do is redirect the home page and my 7 other pages to the new domain with a few pages changing names too. How should the .htaccess file code look like? Please help I want this to be fixed.
Hi, You can try this simple method on your .htaccess file. Let say if you are using index.html on your myoldsite(dot)com, then replaced the above 1st line with /index.html. Cheers!
I agree with marsh_candy, the method he gives is really a easy method for redirection. Of course, you also can use permanent to replace 301 in that two lines.
Out of interest does anyone know if its possible to do this without entering the full domain?. i.e. i could never get the below to work: Redirect 301 /contact.htm contact.php or Redirect 301 /contact.htm /contact.php I always found i had to use the full domain with http i.e.: Redirect 301 /contact.htm http://
I've tried that. But it won't work. Should I have any other codes in my .htaccess file before this code or can it be blank? Also where in my server should I upload the file? In the root where all my website's folders are or in the folder of the old domain? (i use filezilla so instructions would be nice too )
Robin There should be no other codes/lines. 1) Copy and paste the below 5 lines into a text file and save it as file .htaccess Note it has no file name, just the extension .htaccess Change the below last part of each line to your new website domain: Redirect 301 /index.htm http:// yournewdomainincludingwww Redirect 301 /index.html http:// yo urnewdomainincludingwww Redirect 301 /default.htm http:// yournewdomainincludingwww Redirect 301 /default.html http:// you rnewdomainincludingwww Redirect 301 /index.php http:// yo urnewdomainincludingwww So you now have a file called .htaccess containing only the above 5 lines 2) Upload the .htaccess file to your root folder of your old website/domain using filezilla. The root folder might be called something like htdocs. I am assuming you currently have 2 websites old and new and both are up and running ie you havent cancelled the hosting/webspace on the old website 3) If the above still does not work contact your isp giving them the above information to check .htaccess is allowed/enabled on your webspace. Hope this helps