Apache httpd.conf for redirecting ip to hostname

后端 未结 6 1964
执念已碎
执念已碎 2020-12-25 14:18

I have external IP and hostname configured for my machine.

Inside the application, I am using only the domain names to access the APIs. So when i try to access my AP

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-25 14:52

    Ok. You are missing a rewrite condition

    
    
    DocumentRoot "/var/www/html"
    #ServerName ayz-abc.mysite.com/
    
     # Other directives here
     RewriteEngine On
     RewriteCond %{HTTP_HOST} !^ayz-abc.mysite.com$
     RewriteRule /.* https://ayz-abc.mysite.com/ [R]
    
    
    

    If you don't include this condition it will redirect even with the hostname

提交回复
热议问题