WebSite X5Help Center

 
Claudio M.
Claudio M.
User

Sharing my .htaccess.dms -> Rewrite to https (and correct Charset)  en

Auteur : Claudio M.
Visité 1661, Followers 1, Partagé 0  

Hi to all X5 users. I like to share a code-snippet from my .htaccess file. When I first wrote it, it took me quite a while. But I think, other would may be intrested in this:

#Rewrite everything to https
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.yourpage.com$ [OR]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.yourpage.com/$1 [R=301,L]

This code will rewrite seraches like: yourpage.com and www.yourpage.com and http://www.yourpage.com to the saver version: https://www.yourpage.com

--> I dont know, why X5 has not implmentet the following one, but I would recommend to add it as well:

#Adding the default Charset
AddDefaultCharset utf-8

Those code-snippets are working correctly. I testes them with several tools, and even for the Google SEO-Bot will see it as a correct rewrite to https and a correct Charset-definition

Hope it will help some of you for further improvements cool

Posté le