Technology

Optimal Apache Settings for a Seamless Domain Transfer

Explore the optimal Apache settings for a smooth domain transfer, including efficient redirect techniques and virtual host configurations. Ideal for enhancing technical web development and SEO strategies.

Sangrak

This article is similar to the one about [the best use of Rewrite+PHP source while transferring domains](http://awhile.us/blog/2011/07/%EB%8F%84%EB%A9%94%EC%9D%B8%EC%9D%84-%EC%9D%B4%EC%A0%84%ED%95%98%EB%A9%B4%EC%84%9C-%EC%93%B0%EA%B8%B0%EC%97%90-%EC%A2%8B%EC%9D%80-rewritephp-%EC%86%8C%EC%8A%A4/" target="_blank").

You don't necessarily need to use PHP and the Rewrite module as there's a simpler Apache configuration available. I typically use the /etc/apache2/sites-enabled directory for hosting multiple sites, listing virtual hosts within. The following configuration enables you to redirect to the desired domain efficiently. For instance, accessing http://olddomain/asdf will smoothly redirect to http://newdomain/asdf. Note that this redirection uses a 301 Move Permanently status.

<VirtualHost *:80>
	ServerName olddomain.com
	Redirect permanent / http://newdomain.com/
</VirtualHost>

The permanent (permanent redirection, 301) part can be replaced with temp (temporary redirection, 302), seeother (reference, 303), gone (permanently deleted, 410, the URL path does not pass) or left unspecified, with temp being the default value if unspecified.

The documentation I referred to is [http://httpd.apache.org/docs/2.0/ko/mod/mod_alias.html](http://httpd.apache.org/docs/2.0/ko/mod/mod_alias.html" target="_blank").

More on this topic