Issue with www

Hi,

I have a probleme with my domain names,
So, I host two domains names in the same server,
Let’s say: Exemple1 .com is the first domain name I have hosted, and Exemple2 .com is the seconde one.

Now: When I try to access the fisrt website with or without www it’s OK
The second website will be shown only if I try like this http://exemple2 .com
But when I try www.exemple2 .com: The first website will be shown.

On Cloudflare in DNS records named www I tryed the two folowing cases:
1- As cname record type where the value is exemple2 .com
2- As A record type where the value is the Ip address of the web server.

Can you help please ?
Thank you !

You probably havent properly configured the webserver’s virtual host for the www record of your second domain.

Hi Sandro,

Thank you for your message,
I don’t know really if the webserver’s virtual host for www record of my second domain name is not properly configured,

Wish file should I see?
My websites are hosted in my own server with nginx.

Thanks in advance,
Hassan

I think this will help you.

To check configuration files for errors:

Fedora, RHEL, CentOS, OSX

httpd -t

Debian, Ubuntu

apache2ctl -t

MacOS

apachectl -t

kissanime

Thank you Sanctempdyra for your response,

But this command “apache2ctl -t” dosn’t work with me.
“bash: apache2ctl : commande introuvable”

My server OS is Raspbian, and my web server is Nginx.

Thank you,

At this point, it’s a server configuration issue, and not due to Cloudflare.

But you can set up Page Rules here to redirect any www requests to the naked domain:

Match: www.example1.com/* and add a Setting for a Forwarding URL (Code 301) to https://example.com/$1 (or just http if you don’t have SSL set up)

Thank you very much Sdayman,

Your trick is awesome.

Br,
Hassan

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.