ISPConfig and Apache wildcard subdomains issue - apache

I own a VPS with ISPConfig installed. On that VPS we got 4 websites, which are running well, but we have recently spotted problem with Google indexing nonexistent subdomains.
No matter that if you type www.xxx.com or www.xxx.xxx.com or www.yyy.xxx.com or yyy.xxxx.com it will load the main website www.xxx.com, which is, I assume, bad for Google as we give them millions of pages to index. I got to mention that subdomains "xxx" and "yyy" were not preset, in a matter of fact we got no subdomains at all, except "mail", which we use to reach the Roundcube for our websites.
I spotted that the "auto-subdomain" setting for every website is "*." and setted it to "www.", which fixed the issue with redirect but now all subdomains are still reachable - response code is 200 and they show empty pages.
I would like to show 404 error or something like that, not OK status.

Take a look at your dns manager, probably you have an "*" A record with *.xxx.com pointing to your IP address, then if you type this.xxx.com or that.xxx.com, you get www.xxx.com.

Related

How do I stop my domain name maliciously redirecting?

I have set up my website running on Apache2 on an Ubuntu server. I have two domain names from mydomain.com. I linked them up and they work, usually. But, often, when I try to load the domain name , I get redirected to another advertisement site.
When I load my server IP, it always displays the correct site.
Running: “curl myip” gives me the correct HTML.
Running: “curl www.my-domain-name” gives me...
<HTML><FRAMESET><frame src=“searchvity.com/?dn=“my-domain-name”&pid=9PO1MNJ3”><FRAME src=“blank.html”></FRAMESET></HTML>
Which is someone else.
I do not know how this is happening, or what I could do. It has happened for a while, and doesn’t always happen.
I own two domains and they both redirect to the same site.

cPanel redirecting some subdomains to defaultwebpage.cgi

I'm not really sure what's going on here.
We have a main domain and 5 parked domains.
We added a subdomain for each of the 5 parked domains to point to the same home location; /home/main_domain/public_html/sub
Three of the five subdomains work without issue. The other two return the default website cgi.
We initially created the subdomains last week. So I feel that time isn't the issue.
Things I've tried:
cleared the cache many times
switched browsers.
used incognito mode
used curl
deleted and recreated the subdomains numerous times
deleted all of the non-working subdomains and added them one at a time
removed everything in my .htaccess file
flushed my dns (windows 10)
It really puzzles me that only 2 of the 5 are having issues. I'm running out of ideas here. Any help would be greatly appreciated.
Edit: Ok so I just used the "Track DNS" tool in cPanel and found that the two subdomains that aren't working have a different ip than the other three. I'm still investigating why that is though.
It looks like the two parked domains had an old IP being used for their A records.

Keep old URL after redirect

How do I keep the URL after redirecting to a new server?
I have a server on Amazon, with a IP address for its URL. I also have a domain name which I got from nic.ru (a Russian hosting company). I paid $5 and got nic.ru to do a redirect to my new server.
When the redirect goes through, the URL that is displayed is the Amazon server IP (that is, I type http://bezpontavto.ru which is redirected to http://54.186.37.214/; but 54.186.37.214 is then displayed in the URL bar) I want the URL to redirect from http://bezpontavto.ru to http://54.186.37.214/ yet still display as http://bezpontavto.ru in the URL bar.
I dont have access to the apache.conf file at nic.ru (they do it automatically). I have however set up mod_rewrite, on my new server, and have a nice new blank .htaccess file set up in the /var/www/html/ directory.
What do I need to do to display the old URL in the url bar?
(I guess this is pretty simple, but I have been hitting my head against the wall all day, any help would be much appreciated)
You want to get nic.ru to set up A records that point to your new server. This is usually possible without additional charges, and there is usually a DNS configuration interface to make it possible.
Your Amazon server needs to have been prepared to serve the .ru domain (Apache needs to have a VirtualHost entry set up).
For anyone looking fo do a frame redirect from nic.ru, you have to do it under the menu item "My Domains" (Мои Домены):
To do a DNS redirect, which Pekka mentioned was superior, nic.ru offers a DNS service. The details are at http://dns-master.ru/tariff/en/

Redirect 301 using.htaccess on a virtual server

I really have done searched and read dozens of replies on this old worn out subject. My "virtual server" must be different to the ones I read about here.
I have no cPanel. I have a Linux platform powered by Apache. I know the "root" of the server is a "free domain" which is never used and added domains sit on the webspace in folders. I can use redirects and expires and a few other instruction used on .htaccess. OK - redirects do not work - sometimes! Expires worked once and never again - at least I cannot see on Google Pagespeed that an expiry as been applied to a bunch of files.
I think teh redirects are blighted by AB Zero.html not being AB_Zero.html or AB-Zero.html ditto a similar issues with various folders.
The website originated in 2002 and I inherited the file and folder names.
I tried adding " %20 " to the spaces - to no avail.
Thats the story, the question is - is there another way to handle redirects that overcomes this problem?

Trouble setting up a subdomain on a VPS under Ubuntu and Apache

I'm a complete newbie when it comes to servers, so I need some help. Basically, I want to have a subdomain on my VPS. I'm not too concerned where the files reside, though of course I would like them separated if possible.
I found a guide to doing this that basically sums the procedure up in five steps:
Create directories to host the content of a new virtual site.
Make a copy of the /etc/apache2/sites-available/defaults file with a site appropriate name.
Change the two /var/www/ entries to the actual directory of the new site.
Add the ServerName line with the real domain name you will be hosting.
Use a2ensite to enable the new site, and finally reload Apache2 so it knows about the new site
I tried all of this, but I can't get it to work. I didn't get any errors at any point during this process, but when I enter the address with the subdomain into my browser, I get a "Server not found" error.
The company that hosts my VPS has an admin page where I can set up subdomains. Stupid question: do I have to do reconfigure the DNS records or something while doing this, or is it likely that the problem is caused by something else?
Additional note: I followed a guide on howtoforge.com when setting up the server, which in hindsight may not have been the brightest move on my part. It is possible that I made a mistake there that is somehow affecting me now?
Assuming you've setup the subdomain correctly in your VPS' admin page, the only thing left to check here is that you've actually created the subdomain in your DNS administration page (have you?). For example, I use afraid.org to manage my DNS records and to add a subdomain, it's essentially:
Type: A
Subdomain: sparky
Domain: example.com
Destination: 120.34.2.3 (this would be your VPS' IP address)
In general, you add a (sub)domain by:
sparky.example.com A 120.34.2.3
Please keep in mind that you want to add an A record (this is important!).