Why are http and https protocols pointing at different directories? - apache

I originally had 4 subdomains, and when each was created, they were assigned a subdirectory off my public_html
So
subdomain1 points at public_html/subdirectory1
subdomain2 points at public_html/subdirectory2
subdomain3 points at public_html/subdirectory3
Each had a Wordpress site installed in the appropriate subdirectory
I then purchased a global (wildcard) SSL certifcate, and installed it... so it was for *.mydomain
And then all I had to do is in each Wordpress install, change the site url and home url, in General settings, to be https: subdomain.mydomain instead of http:subdomain.mydomain
Everything worked fine, I had no other changes to make.
Since then, I have added new subdomians, subdomain 4 and subdomain5
Again, each was assigned a subdirectory off public_html
subdomain4 points at public_html/subdirectory4
subdomain5 points at public_html/subdirectory5
Wordpress installed on each.
Each worked OK when the site and home urls were http:
Changing to https: site becomes unobtainable! White screen all the time, no error messages.
I contacted the tech support of my hosting providers, and what we established was that an http: request was targetting the public_html/subdirectory4 (or 5) directory, but that an https: request was targetting public_html ! They said that I had to amend my public_html/.htaccess file to redirect the https requests, on a subdomain by subdomain basis, to the relevant subdirectory.
Apart from this having knock on effects in the code of my sites, some of which is common across all 5, I do not understand why this is necessary. It was not necessary for the original sites that were present when I installed the SSL certificate. There are no entries in either the .htaccess file in public_html or in the .htaccess files of each subdirectory that pertain to http or https access.
There must be something else somewhere that makes the original subdomains work, but not the new ones created SINCE the SSL certificate was installed.
And it is nothing at all to do with Wordpress because I created a new subdomain and subdirectory with nothing but an index.php file echoing "Hello world", and it works if requested through http, not if requested through https:
I need to know anything else that can be making the original subdomains work WITHOUT any alteration to the .htaccess files, and why the new subdomains, created after the SSL certificate was installed, behave differently. And then obviously how to make them behave as the original subdomains do.

Don't know why the Tech Support for my hosting company couldn't tell me this, it was so simple once I looked in the right place.
Logged into WHM, and there's an SSL/TLS tab. Looking under "Manage SSL Hosts", I could see the subdomains that were working correctly had an entry in the table there. Backing out, and going to "Install an SSL Certificate on a Domain", I was able to install the certificate to the new subdomains, and lo and behold, when I returned to "Manage SSL Hosts", the new subdomains were there too.
So, undid all the changes made to the new WP installs, and now working perfectly, in the same manner as the all the other subdomains.
Hope this saves somebody else half the time I wasted!

Related

Why is my IONOS 1&1 root not redirecting correctly over ssl?

I have a 1&1 IONOS domain for my heroku app. the www subdomain works fine, with a CNAME setup for it. but I'm trying to redirect the root url to the www subdomain. this also works fine for http, but if the url is typed in as https://example.com, I get a ERR_SSL_PROTOCOL_ERROR (on chrome, other browsers have different errors). this is on any device, regardless of clearing cache and history etc.
my heroku logs show it's never reached, so it must be an issue within 1&1.
theres an ssl cert set on the domain with 1and1, as well as heroku's ACM.
any ideas?
To make the four URL variations (http://example.com, http://www.example.com, https://example.com, and https://www.example.com) point to a different SSL hosted site (heroku, cloudfront, etc), you need three things in IONOS:
Under DNS settings, add a CNAME entry for the www subdomain that points to your SSL hosted site (example.herokuapp.com)
Set up an HTTP Redirect under Domain Forwarding to https://www.example.com (don't check the box that states "Also set up for www subdomain")
Make sure you have an SSL wildcard certificate for *.example.com installed and attached to your domain in IONOS
It looks like all you are missing is number 3. After that, the redirect that you have setup should work as expected.
Note: example.com should be replaced by your actual domain in all of the above.

SSL certificate and "www" vs non "www"

I'm being asked to redirect a website to https once an SSL certificate is installed. It's a wordpress site and this should be very easy, you simply go to settings and change the http to https, and/or install a plugin to manage everything for you and change all of the "http" in your files for "https".
The certifiate came with problems that the host fixed gradually (it wouldn't pass any test on qualys SSL Labs). However for some reason they sent me an e-mail stating that the certificate is made for the "www version of the site". this site didn't have "www" in it's address.
The non "www" version now redirects to the "www" version but I just cannot get a green padlock. Oddly enough, I did get one refreshing the page a few times and when I did it was all messed up. If I check the page source some stylesheet links for example look for the https:// no www version of the page and this is probably the problem right?
Should I just change manually all of the links in the page or ask the host not to create a certificate for a www version of this website when it didn't have that in the first place?
/* EDIT */
I get this in the console before an error for every single url in the page for images and stylesheets, etc.
Redirecting navigation because the server presented a certificate valid for www... but not for "non www version" To disable such redirects launch Chrome with the following flag: ...

Hosting not loading pages

i am new to web hosting, but i purchased a domain from namecheap.com and i purchased web hosting from ramnode.com to host my domain, i am using centOS 32bit as my server, and i have pointed my domain to ramnode nameservers that were provided to me.
The problem i am having here is that everytime i load my website, it just says
Index Of/
cgi-bin/
even though i have placed my web page files in var/www, and var/www/html like ramnode support told me too, it still does not want to work. Any suggestions?
It all depends on how your server is setup but here are a few things to check.
What are the permission levels for your files, who owns them and what group are they in? If you don't have proper permissions set they may not show. If the wrong person owns them they may not show.
Read over your httpd.conf (centos should have it in /etc/httpd/conf) see how your server is setup. It may not have a default setup, perhaps your using a virtual host?
In a nutshell we need more information to help you out.
You should have an
.htaccess or htaccess.txt file in your WWW root, whithin that file you need the following line:
DirectoryIndex index.htm index.html index.php
That is the priority order of your index page. (Your web project needs an index page)
So in otherwords your webserver will serve the first matching file that it finds in that list.
A quick fix if you cant find the htaccess file, is just make sure you have an index.html file in your var/www
I just reset my nameservers to point to ramnode's last night and am experiencing the same issue as the OP this morning.
I previously had no FQDN for the ramnode server and simply used my /etc/hosts file locally to point to the ramnode server. Through that method, I was able to make sure everything was setup just so - apache virtualhosts, .htaccess files, apache.conf, and httpd.conf files all operating as desired.
It seems to have something to do with the installation of the cpanel, which auto-fills DNS A records with a different IP than the one I was provided. changing it to ramnode's original IP simply leads to the same cgi-bin directory index. But going going to the original ip in the browser leads to my site, as I have the apache virtualhost set for the IP.
Ramnode sets subdomain a records such as cpanel.mydomain.com all set to the same new IP and those do function, so it leads me to believe a ramnode server is capturing the trafic elsewhere and should be sending it on but isn't.
It's a bit confusing where cpanel is taking me and why redirecting to my the domain.com. A record to the original IP seems to have no effect.

Where to upload files for subdomain over HTTPS in PLESK 10?

This has taken me hours already.
I've a new server with a fresh PLESK 10 installation. Now subdomains are handled differently in PLESK 10, that I know (not domain.tld/subdomains/httpdocs but domain.tld/httpdocs_subdomain for instance).
Now, I got a subdomain working over HTTP perfectly. However, when I change it to https://subdomain.domain.tld it just gives me a Default page.
In older versions, one could select "use one directory for both http and https" but PLESK 10 seems to make no difference anymore. However... Why do I get a Default Page when using https? And more important: How to fix this?
I hope someone can help me out!
Plesk 10 changes the way it manages http and https.
Both http and https point to the same directory now.
When you create a subdomain in Plesk 10, a directory is created in your http root and in the subdomains folder, so say you create a subdomain called "secure", you'll get:
/secure
/subdomains/secure
As for your issue, is SSL enabled for that subdomain?
Within Plesk 10 ensure you have SSL enabled:
Website & Domains
Click on your subdomain
Check Enable SSL Support
Maybe its easy:
Open Plesk
Click on required Domain
Click on File Manager
Click Sub Domain Folder.
Click Add File
Give the path and Click on some buttons.
It does not matter if you are using plesk with https ot http, because even configured over SSL it always fetch the files from httpdocs folder.

How to rewrite paths on single SSL secured subdomain to secure web apps on other subdomains using htaccess

Let's say I have an SSL secured domain at secure.domain.com.
I also have a web application (using silverstripe) at www.domain.com and another at app.domain.com (using CakePHP)
I would like specific areas of www.domain.com and app.domain.com to utilize SSL, and thus must somehow rewrite the paths using the subdomain with the installed SSL certificate.
So for example, secure.domain.com/ss/* should rewrite to www.domain.com/* and similarly, secure.domain.com/app/* should rewrite to app.domain.com/*.
The challenge, however, is that both www.domain.com (SilverStripe) and app.domain.com (CakePHP) have their own complex rewrite rules, and I can't seem to build an htaccess script that successfully retains the functionality of the respective applications...
FYI Assume I have the directory structure /public_html and webroots assigned to the apps as follows:
www.domain.com -> /public_html/subdomains/www
app.domain.com -> /public_html/subdomains/app
secure.domain.com -> /public_html/subdomains/secure
Has anyone accomplished something similar to this before?
The most elegant way is to simply symlink the SSL subdirectory to the apps folder, so they're basically the same directory.
/public_html/app
/public_html/subdomains/secure.domain.com -> /public_html/app
That is, if your host gives you this option.