2

For some time I used a free account to host my online forum. Recently I bought a domain name, and now it contains a full copy of all the php and mysql data in the forum, so now there are two copies of the forum in different locations. The last step I need to accomplish is to erase all the data in the old location, and replace it with a short htaccess file that will make a global redirect. What would the contents of this htaccess file look like ? I don't know enough Apache to be sure.

I found many related topics to this one here on MSE and elsewhere, but none that could match my needs exactly . Most are about redirections to just a subfolder inside a single server.

Note : the whole point of this question is that I wish the users of the forum to use the same URL as before, I wish to avoid to have to tell everyone that the forum's URL has changed. Nonprofessional users dislike changes

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
Ewan Delanoy
  • 1,276
  • 2
  • 13
  • 31
  • You need a 301 redirection (Moved Permanently). Possible duplicate with: http://stackoverflow.com/questions/4037467/301-redirect-htaccess – ADreNaLiNe-DJ Feb 22 '16 at 11:10

1 Answers1

3

If mod_alias is active:

Redirect 301 / http://your-new-site.com

otherwise, if mod_rewrite is active:

RewriteEngine On
RewriteRule ^ http://your-new-site.com%{REQUEST_URI} [R=301,L]
hjpotter92
  • 78,589
  • 36
  • 144
  • 183