RE: How Can I Set Up Apache2 to Serve My Sites as .com w/out https:// Headings?

Hello,

I have a set up of my Apache2 server on Ubuntu 18.04.x 4.15.0-64-generic.

I am trying to make it so I can just type in mywebsite.com instead of https://www.mywebsite.com to have it work outside of my current location.

I am using a Linode 2GB plan. I followed the instructions, set up https, and reread the apache2 config. options for this specific site. I am coming up short. Is there a particular set up I am missing?

<VirtualHost *:443>
    ServerAdmin seth@mywebsite.com
    ServerName mywebsite.com
    ServerAlias mywebsite.com www.mywebsite.com

    DirectoryIndex index.html BlogStar.html News.html Contact.html
    DocumentRoot /var/www/html/

    SSLEngine on
    SSLCertificateFile /etc/ssl/parish.com/parish.crt
    SSLCertificateKeyFile /etc/ssl/parish.key/parish.key
    SSLCertificateChainFile /etc/ssl/parish.com/parish.ca-bundle

    LogLevel warn
    ErrorLog /var/www/html/mywebsite.com/log/error.log
    CustomLog /var/www/html/mywebsite.com/log/access.log combined
</VirtualHost>

and…

<VirtualHost *:80>

    ServerAdmin seth@mywebsite.com
    ServerName mywebsite.com
    ServerAlias mywebsite.com www.mywebsite.com

    redirect permanent / https://www.lafayette-parish.com

    SSLEngine on
    SSLCertificateFile /etc/ssl/parish.com/parish.crt
    SSLCertificateKeyFile /etc/ssl/parish.key/parish.key
    SSLCertificateChainFile /etc/ssl/parish.com/parish.ca-bundle

    DirectoryIndex index.html BlogStar.html News.html Contact.html
    DocumentRoot /var/www/html/

    LogLevel warn

    ErrorLog /var/www/html/mywebsite.II.com/log/error.log 
    CustomLog /var/www/html/mywebsite.II.com/log/access.log combined

</VirtualHost>

So…

I tried a Redirect w/ Apache2 and this has not helped thus far. If you have any pointers, please contact me.

Seth

5 Replies

Hello Once More,

I keep trying to set up the site under Apache2's website under 2.4 Documentation.

I have tried numerous things. All have failed thus far. If you know what I am discussing, please let me know.

Seth

P.S. Just for reference, I have set up the above config. to run my site from mywebsite.com and have it direct to https://www.mywebsite.com. Also, I tried www.mywebsite.com to have it direct to https://www.mywebsite.com. I have tried both, neither, and one at a time.

Hello Again,

Seth here. I guess what I am really asking is this:

How can I type in the browser my web address w/out the ending "/" and still receive the https://www.mywebsite.com settings?

For instance: 

This:

mywebsite.com

NOT:

mywebsite.com/

Seth

P.S. I still want the browser to report to the https settings in my config. pages but also agree to use the "This:" from above and not the "NOT:" from above, i.e. if that makes sense.

Hey there,

We're happy to try and help with this. It seems like you are very close!

I am trying to make it so I can just type in mywebsite.com instead of https://www.mywebsite.com to have it work outside of my current location.

This is the normal behavior if you have your DNS properly configured to connect mywebsite.com to your IP address and your SSL certificate correctly installed. This will automatically provide a secured website connection without a redirect needing to be configured. The virtualhost configuration you provided initially for port 443 appears to be properly configured for this.

P.S. Just for reference, I have set up the above config. to run my site from mywebsite.com and have it direct to https://www.mywebsite.com. Also, I tried www.mywebsite.com to have it direct to https://www.mywebsite.com. I have tried both, neither, and one at a time.

We recommend commenting out the redirect line of your port 80 virtualhost configuration as it's not needed to serve your site securely. If your DNS records are correct and your SSL certificate is properly installed and served, you won't need a redirect.

How can I type in the browser my web address w/out the ending "/" and still receive the https://www.mywebsite.com settings?

You can check your DNS configuration for your 'mywebsite.com' to ensure you have a Fully Qualified Domain Name (FQDN) with a DNS A/AAA record pointing to the domain’s Public IP address. This appears to be correct based on the information you provided once the redirect is commented out. Then you can make sure that your SSL certificate is properly installed and set to renew. If you are using Let's Encrypt / Certbot this guide will offer some step-by-step assistance. Otherwise, we recommend using the documentation of the SSL tool you utilized originally.

When those settings are all correct, traffic to 'mywebsite.com' will be automatically secured with http, same as traffic to 'www.mywebsite.com' and 'mywebsite.com/'. You can test the security of the url connection directly from your browser(s):

Chrome - Desktop

Chrome - Mobile

Firefox

Internet Explorer

Edge

Safari

We hope that helps. Keep going! Let us know if you are able to make progress.

@Ttaylor

Hello,

Seth here. I removed my redirect and my site works. If you get bored, you can look at the generics of my site at this address:

lafayette-parish.com/

and not…

lafayette-parish.com

See the difference in my sites "/" character? I changed the www in my A/AAAA record to an A.

A    125.1245.582.2    default

instead of…

www    125.1245.582.2    default

I am waiting for changes to take place. I will return service.

Seth

Okay and Hello,

I changed the info. online at my Linode dashboard under the Domains option w/ the A/AAAA Records.

Like listed above, the site is now offline. Ouch. I can always put the site back together w/ the redirect but I think you are correct. You are mostly more knowledgeable on this subject and that is why I am reaching out.

A    mywebaddress    default

This is what I typed in thinking this is what you meant for me to type in on the Domains option screen under A/AAAA Records.

My site went down when I removed the www and replaced it w/ an A under the Domains option screen for the A/AAAA Records.

Seth

P.S. Close but no cigar. Yet! I will keep trying. Oh and I have a CNAME Record too. I changed the default to mywebsite.com w/out the www in front, i.e. like this: www.mywebsite.com.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct