Redirecting or rewriting domains and URLs

 Leonie Vuilleumier

Part of any website are the domains and URLs that users type in their browsers in order to reach a web page. However, it can be challenging to manage should it need to be changed. Thankfully, there are URL redirects for that.

URL redirect (forwarding) allows you to forward your domain visitors to any URL of your choice, either to a new domain or a different website altogether.

In an Apache web server, use the following rewrite rules in your .htaccess file.

Tags

Apache Configuration Test

MacBook Pro turned on beside Apple Magic Mouse on top of white surface

When making changes in your httpd-vhost.conf file, make sure to test it before reloading the apache config file or restarting apache.

Mac OSX

apachectl configtest

XAMPP OSX

/Applications/XAMPP/xamppfiles/bin/apachectl configtest

Errors should display, if there are any, otherwise you'll see the Syntax OK to indicate that there are no errors and you can reload the apache config file or restart apache.