domain is not the same with or without a www , (18 posts)

  1. brokensite
    Posted 4 years ago #

    I have configured DNS and everything correctly, it even works perfectly for subdomain but not the main domain , have a look please:


    and example subdomain


    which is exactly the same with or without www, I think there is a problem with wordpress , I mean not WP but actually my possible configurations

  2. Since you set up your site with www, I would put this in your wp-config.php file, just below the last MultiSite line:

    define( 'NOBLOGREDIRECT', 'http://www.commentchoisirtv.com/' );
  3. brokensite
    Posted 4 years ago #

    Wow , you helped me again, and it works like a charm as always , thank you so much

  4. brokensite
    Posted 4 years ago #

    It took me hours to check all my DNS records and everything, Thank you for your solution , I feel safe and happy when I see your comment under threads.

  5. No problem :) Normally WordPress is pretty good about knowing that www and non-www are the same site, but all it takes is one weird server config to make it forget. What that line does is say 'If there's no blog, just go to the front page.'

    If you don't have registration open, or if you don't want to advertise that it's open when people go to fake subdomains (like dfsdfsdfsdf.domain.com) that's the easiest fix.

  6. brokensite
    Posted 4 years ago #

    That's a great easy fix, the only problem is that it will redirect all pages without www to home page,
    an example :

    which will be redirected to home with out www


    I do not know how to resolve this, Happily the website is under construction

  7. brokensite
    Posted 4 years ago #

    the interesting thing is that if i copy a simple html file in root like this test file it works with or with out www, which (in my point of view as an amateur) means that DNS has been configured properly and WP configuration is the cause of it



  8. Try putting this on the top of your htaccess (ABOVE the WP lines)

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^commentchoisirtv.com/$
    RewriteRule ^(.*)$ http://www.commentchoisirtv.com/$1 [R=301]

    I don't know why WP does that sometimes. Normally if you set up a site as domain.com (NOT http://www.domain.com) it handles it just fine. It's probably something in your server config.

  9. brokensite
    Posted 4 years ago #

    I have added that in htaccess, it's the same, I hate Plesk, may be that's because of ples DNS config :
    *.commentchoisirtv.com. CNAME commentchoisirtv.com.
    *.webmail.commentchoisirtv.com. CNAME commentchoisirtv.com. / 24 PTR commentchoisirtv.com.
    commentchoisirtv.com. NS ns.commentchoisirtv.com.
    commentchoisirtv.com. A
    commentchoisirtv.com. MX (10) mail.commentchoisirtv.com.
    commentchoisirtv.com. TXT v=spf1 +a +mx -all
    http://ftp.commentchoisirtv.com. CNAME commentchoisirtv.com.
    mail.commentchoisirtv.com. A
    ns.commentchoisirtv.com. A
    salon.commentchoisirtv.com. A
    webmail.commentchoisirtv.com. A
    http://www.commentchoisirtv.com. CNAME commentchoisirtv.com.

  10. Oh. Plesk. I hate it too.

    You have to add that htaccess and then REMOVE the line from the wp-config.php.

    I don't think it's a DNS issue, mind you.

  11. brokensite
    Posted 4 years ago #

    I have done that, it now like where i was in the first place, every single page with out www is redirected to this url http://www.commentchoisirtv.com/wp-signup.php?new=commentchoisirtv.com


  12. I did some plesk digging... I THINK this is because Plesk sees your default as being domain.com and NOT http://www.domain.com (that I'm mostly basing off your DNS, which has commentchoisirtv.com as an A record).

    Try this: Add the www version as an A record (like mail.commentchoisirtv.com ) and NOT the CNAME that it is.

  13. brokensite
    Posted 4 years ago #

    thank you for your time, I have removed the CNAME record and added an A record like you said, I think it will take some time to take effect, Let's see what happens in two hours, by the way I have already had such a record (the A record you said) in my domain registration panel. may be I should have just deleted the CNAME , I will come back shortly to tell you the results:))

  14. brokensite
    Posted 4 years ago #

    my domain registration panel is outside plesk, (all domains have to be registered once again in Plesk anyway) I do not know if plesk configurations over rides the domain registration configurations.
    Sorry to bother WordPress precious time and resources for everlasting inconveniances of Plesk:)

  15. Nah, it's good to know how all the various things work together ;)

    If it's not DNS, it's something IN Plesk that's overriding it, and I don't know Plesk enough to guess at it. In Cpanel/Apache it'd be httpd.conf where I'd START looking.

  16. brokensite
    Posted 4 years ago #

    when trying to reach domain without www I receive this massage in wordpress : the website your trying to reach does not exist and that is the address http://commentchoisirtvcom.www.commentchoisirtv.com

    I am gonna investigate this and I come back soon:)

  17. So we're back to the first problem? Augh.

  18. brokensite
    Posted 4 years ago #

    Ok I have figured out how to make this work, I hate it when people find solution and their disappear , I'm gonna explain step by step what has to be done , (With many thanks to Ipstenu )

    1-Remove www A record from domain panel (outsite Plesk) ,
    www A IP ==> remove

    2- add the same thing in Plesk panel but this time a CNAME record

    wwww CNAME yourdomain.com

    3-add this to your htaccess :

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    so if your in multisite environment your htaccess should look sort of a like this

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]

    Please kindly notice that all this structure applies when you have started your whole installation with www and now you want to redirect non www to www version

    4- add another DNS record to also handle subdomains

    *.commentchoisirtv.com. CNAME commentchoisirtv.com.
    5- you may need to change the configuration of Apache on server and restart it again : here is how to do it for plesk

    this last instruction is to point all sub domain to the same folder as main domain since Plesk points them to sub-folders

    Enjoy :))

Topic Closed

This topic has been closed to new replies.

About this Topic