7 February 2018

APACHE - Redirect URL containing an IP address to domain name

[On]
Red Hat Enterprise Linux Server release 7.4 (Maipo)

Please insert the Rewrite conditions as follows in the .htaccess file located in your DocumentRoot directory.

--- Change the IPs accordingly. ---

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    RewriteCond %{HTTP_HOST} ^10\.24\.19\.85$ [OR]
    RewriteCond %{HTTP_HOST} ^10\.24\.19\.109$
    RewriteRule ^(.*)$ https://{DOMAIN_NAME}/$1 [L,R=301]
</IfModule>

No comments:

APACHE - failed to start

[On] Red Hat Enterprise Linux Server release 7.4 (Maipo) Apache was not running and attempt to start the httpd service failed. The natural t...