Apache Tips : How to force redirect old domain to new domain

Change the definition of Override in /etc/httpd/conf/httpd.conf

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
    AllowOverride All

Then create the following .htaccess into the DocumentRoot.

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mesinfotostat.dev.namran.net [NC]
RewriteRule ^ http://fotostatbaru.dev.namran.net%{REQUEST_URI} [L,R=301]

so. it got change and redirected automatically .. to new domain.
if user happened to access it via the old domain.

This is important when some session data is stored within the domain name.

🙂

Get Free Email Updates!

Signup now and receive an email once I publish new content.

I will never give away, trade or sell your email address. You can unsubscribe at any time.

Like

Related Post

2 Responses

  1. Sara says:

    Pretty good post. I just stumbled upon your site and wanted to say
    that I have really enjoyed reading your blog posts. Any way
    I’ll be subscribing to your blog and I hope you post again soon!

    Reply
  2. Large tv screen that can be used as computer monitors says:

    I do love the manner in which you have presented this specific difficulty plus it does supply me some fodder for consideration. On the other hand, because of what I have seen, I basically wish when the comments stack on that people today keep on issue and not embark upon a tirade of some other news of the day. All the same, thank you for this outstanding piece and whilst I do not really concur with this in totality, I respect your perspective.

    Reply

Anything to add?

X