Report this

What is the reason for this report?

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

Posted on September 20, 2015

To make http://127.0.0.1/wp jump to http://127.0.0.1:8080/wp ,and 127.0.0.1/wp jump to 127.0.0.1:8080/wp ,how to write the rewrite rule in /etc/apache2/apache2.conf ?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

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.127.0.0.1:8080/$1 [L,R=301]

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.