SyTry
Well-known member
Hello,
Currently I'm doing some research on different sites to know the SEO criteria to improve it on my forum. I have a problem with URL Canonicalization :
I use this code in my .htaccess :
Here are the codes recommended by the site :
How to fix - URL Canonicalization Test
In order to pass this test you must consider using a 301 re-write rule in your .htaccess file so that both addresses (http://example.com and http://www.example.com) resolve to the same URL.
- If you want to redirect http://www.example.com to http://example.com, you can use this:
- If you want to redirect http://example.com to http://www.example.com, you can use this:
Note that you must put the above lines somewhere after RewriteEngine On line.
Do I have to redirect the https://www.example.com to https://example.com ?
Currently I'm doing some research on different sites to know the SEO criteria to improve it on my forum. I have a problem with URL Canonicalization :
I use this code in my .htaccess :
Code:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://sytrycommunity.fr/$1 [R=301,L]
Here are the codes recommended by the site :
How to fix - URL Canonicalization Test
In order to pass this test you must consider using a 301 re-write rule in your .htaccess file so that both addresses (http://example.com and http://www.example.com) resolve to the same URL.
- If you want to redirect http://www.example.com to http://example.com, you can use this:
Code:
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L]
- If you want to redirect http://example.com to http://www.example.com, you can use this:
Code:
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
Note that you must put the above lines somewhere after RewriteEngine On line.
Do I have to redirect the https://www.example.com to https://example.com ?