0x3C 0x3C - 1 year ago 100
Apache Configuration Question

Own example.org and can't get www.example.org to redirect

I own

and everything is working as it should. I am using Google Domains and have Dynamic DNS set up with them to point to the Apache server inside of my house.

My issue is that
does not redirect to
, instead it says that
does not exist. Additionally, I do not want
to exist.

I would like for it to redirect, and don't know how to go about setting it up. Can anyone guide me as to how to do this?

Thank you.

Answer Source

www.0x3c.org has to exist, in order to redirect the requests. You have to create a DNS (CNAME) entry for www.0x3c.org, direct it (preferably) to the same server that serves 0x3c.org and then use Apache rewrite rules, as described here:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download