How to redirect to another web page using .htaccess

Learn how to redirect a web page’s visitors to another page using a .htaccess file in this quick and easy tutorial.

Redirecting to a web page on the same domain

To redirect a web page’s visitors to another page on the same domain:

<IfModule mod_alias.c>
	RedirectMatch 301 "^/old-page$" "/new-page"
</IfModule>

Redirecting to a web page on a different domain

To redirect a web page’s visitors to a page on a different domain:

<IfModule mod_alias.c>
	RedirectMatch 301 "^/old-page$" "https://www.example.com/page"
</IfModule>

That’s all there is to it!


Love our articles? HostM offers professional and helpful web hosting services with unlimited features and renewal rates that actually match our advertised rates.