How to write the rewrite rule in /etc/apache2/apache2.conf?

Posted September 20, 2015 2.5k views

To make jump to ,and jump to ,how to write the rewrite rule in /etc/apache2/apache2.conf

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

You can use the rewrite rule inside your vhost, something like this will work:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^12\.34\.56\.789$
RewriteRule ^(.*)$ http://www.$1 [L,R=301]
Submit an Answer