Paul Martinez
Paul Martinez

Reputation: 562

Domain address- misunderstanding in WordPress

I don't understand why this Url:

 www.hortadascanas.com

and this Url:

http://hortadascanas.com

are not pointing to the same page. If you look the content, you can see that icons don't show up at the 2nd adress...Actually It seems to me that the 2nd Url links to an older version of the page.

I thought the "www" was a shortcut of "/public_html".

If I try with this address http://hortadascanas.com/location it is redirected to http://www.hortadascanas.com/location but the home page is not redirected.

What is happening ?

EDIT

This is what I have in my .htaccess file:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] 

I guess I have to remove some lines because the site crashes if I add the lines you gave me....I have redirections loops...

EDIT 2

enter image description here

Should I delete this red line and recreate one pointing to the alias www.hortadascanas.com ?

Upvotes: 0

Views: 26

Answers (2)

Vasim Shaikh
Vasim Shaikh

Reputation: 4522

This can be done by adding the following lines at the beginning of the .htaccess file in your public_html folder:

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

if you want to redirect both HTTP and HTTPS non-www Urls to www, you can combine rules as follows:

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

For more information please read following :

https://www.siteground.com/kb/how_to_redirect_www_urls_to_nonwww/

Edit

In your case its because of CNAME in your cloudflare,please check complete guide for this,

https://help.ghost.org/hc/en-us/articles/223210747-Root-Domain-Setup-Using-CloudFlare

Upvotes: 1

Quentin
Quentin

Reputation: 943635

www.hortadascanas.com and hortadascanas.com are simply different hostnames.

They don't have identical DNS resolution:

[ ~ ]
[ user ][ [email protected] ] %  host hortadascanas.com
hortadascanas.com has address 69.195.124.135
hortadascanas.com mail is handled by 0 mail.hortadascanas.com.
[ ~ ]
[ user ][ [email protected] ] %  host www.hortadascanas.com
www.hortadascanas.com has address 104.27.134.235
www.hortadascanas.com has address 104.27.135.235
www.hortadascanas.com has IPv6 address 2400:cb00:2048:1::681b:86eb
www.hortadascanas.com has IPv6 address 2400:cb00:2048:1::681b:87eb

You end up talking to two different computers depending on which hostname you use.

Running the IP addresses through whois we can see that www.hortadascanas.com is handled by Cloudflare, who provide a CDN and caching service.

Actually It seems to me that the 2nd Url links to an older version of the page.

Presumably Cloudflare is loading the data from 69.195.124.135 and caching it … so it is an older version of the page.


Even if the two hostnames' DNS resolved to the same computer, you could still get different content. Name based virtual hosting allows multiple websites to share a single IP address. The Hostname is included in the HTTP request header so the server can determine which site to return.

Upvotes: 0

Related Questions