0

I got the following setup

My website is located on at this server jdbartist.bplaced.net/gkn

I bought a TLD (gamekeynexus.com) and set it up to redirect to the gkn directory, so when I type my tld into the browser window I get to my site on my server and it says gamekeynexus.com in the browser = awesome! Now the only thing that bothers me is that

IF someone KNOWS the old address, he's able to reach the site via this old address (i.e type jdbartist.bplaced.net/gkn)

My question would be, how can I redirect calls to my old URL to my new URL?

I guess an htaccess redirect would do the job, but I am not sure where to start.

4

2 に答える 2

1

たぶん、このPHPのスニペットが役立つかもしれません

<? 
if($_SERVER['HTTP_HOST'] == 'jdbartist.bplaced.net') { 
header("Location: http://gamekeynexus.com/");
}
?>
于 2013-02-16T10:48:36.347 に答える
0

簡単な書き換えを使用できます。

RewriteCond !%{HTTP_HOST}  newdomain
RewriteRule (.*) http://newdomain/$1 [L]

ドキュメントをご覧ください:http://httpd.apache.org/docs/current/mod/mod_rewrite.html

于 2013-02-16T10:43:02.260 に答える