Apache Redirection

There are times we need to do a redirect on the server side.
301 redirect is a preferred way of redirect for SEO sake.
I will show you 2 ways of configuring Apache HTTP Server to do redirect by modifying httpd.conf or .htaccess file:

1. Using mod_alias

Redirect permanent / http://www.your-new-website.com

2. Using mod_rewriteRewriteEngine on

RewriteCond %{HTTP_HOST} ^www.your-old-website.com
RewriteRule ^(.*)$ http://www.your-new-website.com$1 [R=permanent,L,NE]

Please remember to reload or restart Apache after that.

Reference:
http://www.yolinux.com/TUTORIALS/ApacheRedirect.html

Advertisements

One thought on “Apache Redirection

  1. You really make it seem so easy with your presentation but I find this matter to be
    actually something which I think I would never understand.
    It seems too complex and very broad for me. I am looking forward for your
    next post, I’ll try to get the hang of it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s