If I change this to <base href=https://www.000webhost.com/forum/t/custom-font-load-with-www-and-without-www/"http://domain.be/"> than the font-problem is reversed… (If I don’t use base href my css-file doesn’t load.) <link ..." />
If I change this to <base href=https://www.000webhost.com/forum/t/custom-font-load-with-www-and-without-www/"http://domain.be/"> than the font-problem is reversed… (If I don’t use base href my css-file doesn’t load.) <link ..." />
Join the Conversation
A community of people sharing their web development knowledge.
When I watch my site on www.domain.be (with any page after it, like for example www.domain.be/error-404) all fonts are loaded and shown correctly.
If I watch the pages like domain.be (and domain.be/error-404) the fonts don’t load correct: they just show times new roman or verdana or something standard.
I use <base href="http://www.domain.be/">
If I change this to <base href="http://domain.be/">
than the font-problem is reversed…
(If I don’t use base href my css-file doesn’t load.) <link rel="stylesheet" href="css/main.css" type="text/css" media="screen" />
To solve this I just wanted to redirect any non-www page to www with htaccess
I had these lines in there to redirect https to http.
RewriteBase /
RewriteEngine on
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
I changed it to this lines I found on internet (assuming this would redirect non-www to www and keep redirecting https to http - but it doesn’t do the latter).
So, there’s a reason why the code you’re using isn’t working — the browser wants to redirect a HTTPS-based version of the site to www, and then to HTTP. It’s going to run into a problem because of a certificate mismatch issue.
What I suggest is following my tutorial on using Cloudflare to enable HTTPS on your custom domain, then updating your .htaccess to redirect HTTP to HTTPS (and then non-www to www).
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
By doing this, you’ll not only have a more secure website, but your redirection issue should be fixed and your fonts should load fine. You’ll have to use the following for your <base> line.
Thanks for the advice but it seems like this is gonna take a while, and I’ve already spent so many frustrating hours on that site (at the moment it’s not even fun anymore).
No way anyone could for now, just make this htaccess lines work for base line http://www.example.com ?
So https to http and non-www to www.
Anyone?