enrii.blog

A passionate programmer’s findings in the world of internet.

Redirect a Directory to New Location using .htaccess

October 19th, 2011

After migrating system from temporary server to a new server, we will have to request all users to go to the new site.

I am not an expert in Apache rewrite rules, but finally found this way to redirect everything from a specific directory to a new location.

RedirectMatch 301 / http://blog.enrii.com

Save the file as .htaccess, then put the file into the folder you want to redirect (should be somewhere inside your htdocs folder). Replace http://blog.enrii.com with the new site that you want to redirect.

In case it doesn't work, see if the following line in httpd.conf is commented:

LoadModule rewrite_module modules/mod_rewrite.so

Un-comment it if necessary.

That's how I finally got it working. Please let me know if I am not doing it correctly.

If my article helped you solved your problem, consider buy me a beer!

Share this article: del.icio.us | digg it

Related posts:

Comments are closed.