Mobile app version of vmapp.org
Login or Join
Cooney921

: Redirecting to a specific page if the visitor used a certain name to resolve the server address How can I get visitors redirected to a specific html page if the name used to resolve the server

@Cooney921

Posted in: #Nginx

How can I get visitors redirected to a specific html page if the name used to resolve the server address was a specific one? I tried

if ($http_host ~ /forbiddenname/)
{
rewrite ^(.*)$ /updateyourlinks.html break;
}


inside the Server section, but doesn't work...

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Cooney921

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cooney921

After some research I found that I should use instead of an if a virtual host... what I've added to nginx configuration is another server

server {
listen 80;
server_name *.badname.com;
rewrite ^ goodname.com/updateyourlinks.html; }


and this apparently works

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme