0

I own http://0x3c.org/ 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 http://www.0x3c.org/ does not redirect to http://0x3c.org/, instead it says that http://www.0x3c.org/ does not exist. Additionally, I do not want http://www.0x3c.org/ 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.

0x3C
  • 5
  • 5

1 Answers1

0

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]
Community
  • 1
  • 1
Erki Aring
  • 2,032
  • 13
  • 15
  • So, I added the rewrite conditions and rule to my .htaccess file in my root folder and restarted my apache service. I then went to my Google domain settings and added a CNAME entry at the bottom of my DNS settings page structured like so : `Name: www` `Type: CNAME` `TTL: 1h` `Data: 0x3c.org` and it doesn't appear to be redirecting as it should. – 0x3C Aug 02 '16 at 18:54
  • Strange that it's not working on my admin computer. Ah, well. It did work on my phone, you're right! So thank you! – 0x3C Aug 02 '16 at 19:00