SYSTEM INFORMATION | |
---|---|
**OS type and version:Ubuntu 20.04 | |
**Webmin version:Latest | |
**Virtualmin version:Latest | |
**Related products version: |
Ok, you want your VPS to ānot respondā to some websites which have been pointed to.the IP address of your VPS. My suggestion is to get your server to respond, but in a manner that consumes minimal resources.
One way to do this would be to redirect the unwanted sub-domains to Google or some charity website that you feel kindly towards. A redirect would put very little strain on the VPS.
In addition to your desired outcome of getting your server to ānot respondā if you had also let us know what your pain point is with the way things current stand - e.g. logs getting populated and analytics getting skewed - then the community could respond with relevant suggestions but getting a server to ānot respondā is against norms and RFC specs.
Also meaningful would be the number of undesired sub-domains. If these are few enough in number to process manually, then just create a virtual server for each undesired sub-domain and let the default Virtualmin under construction page show for all URLs under those sub-domains.
Hi,
Since I write I decided to redirect the requests from these domains to an errorpage. That works but as I understand I need to do it for every subdomain, and it come one new per hour about. I cant use wildcards in the rewrite I think, or? I am also loking into how to use cloudflare to only allow requests from their ip range.
I ask again, what is your pain point / problem if someone is pointing undesired domains to the IP address of your server?
If someone had done that to me, my server would respond with the appropriate error message and I would be fine with that. Why is this outcome not fine with you?
The painpoint is more that it is annoying to have to check once per hour if any new subdomains show up and the edit the htaccess. I can use my time better. The site btw is earthfightsback.org
Virtualmin has a default site option. This default site gets served to requests that donāt match any domain or subdomain configured on the server.
Just set up your ādefault siteā and you can handle those requests there. The response page still appears at the address entered by the user, so you can use the host
header in your code to customize the output.
What? No. You donāt add those domains to your server. Just make a ādefaultā domain that is whatever you want it to be. If thatās an error page, thatās fine. If itās your business primary domain website, whatever.
If you have no legit subdomains at all and donāt use www, then I think this would work to redirect them all to your main site:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.earthfightsback\.org$ [NC]
RewriteRule ^ https://earthfightsback.org/index.php [L,R]
If you do use www, then this should work:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.earthfightsback\.org$ [NC]
RewriteCond %{HTTP_HOST} !^www\.earthfightsback\.org$ [NC]
RewriteRule ^ https://earthfightsback.org/index.php [L,R]
Try it first though. Thatās just off the top of my head and not tested.
I think a redirect to the home page is more productive than an error page, especially since the site is trying to proclaim a message.
Richard
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.