• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!

Question Where in Plesk can I configure 301 redirect for non-existing subdomains?

olegos76

New Pleskian
Server operating system version
Rocky Linux 8.10
Plesk version and microupdate number
18.0.62 Update #1
Hello guys.
I am in quite a pickle here :) Please help!

Initial Problem: Google and Yandex robots keep finding subdomains that do not exist!

My server config:
Linux with Plesk Obsidian Web Host Edition - Version 18.0.62 Update #1
Site works in Laravel
Main site is https://mysite.com

... and 3 subdomains that I occasionally use:


BUT Google and Yandex reporting that these subdomains are also found:

I have no idea what they are and would love to get rid of them (or at least hide them from indexing by search engines)
Their own recommendation is to setup redirect 301 to my main site.

What brings complexity, is that I am running my server in: Nginx proxies requests to Apache mode.

Google says that in this case I don't need to make changes to .htaccess, but add the following to my nginx configuration:

server {
listen 80; # Adjust port if needed
server_name ~^(?!(dev|blog)\.).*\.yoursite\.com$; # Negative lookahead to exclude specific subdomains

# Redirect all other subdomains to your main website
return 301 https://yourdomain.com/;
}

Question 1: is this correct?
Question 2: if so, where in Plesk should I stick this code in?
(I tried placing it into "Additional nginx directives" field, but got an error: "Invalid nginx configuration: nginx: [emerg] "server" directive is not allowed here"

Please advise something...

Thank you!
 
Wouldn't be easier to remove any DNS records for those non used sub domains? Or in case your are using a wildcard DNS record to remove that and use specific DNS records instead?

Be aware though that by default mail. records get created which gets used for MX records. You can remove the mail. records, in which case you need to point your MX records to somewhere else too (the root domain for example).
 
Wouldn't be easier to remove any DNS records for those non used sub domains? Or in case your are using a wildcard DNS record to remove that and use specific DNS records instead?

Be aware though that by default mail. records get created which gets used for MX records. You can remove the mail. records, in which case you need to point your MX records to somewhere else too (the root domain for example).
Thank you! Will try this.
 
Back
Top