Post by rtl7 » Fri Feb 01, 2019 2:15 am

Hi there. Have you noticed, that a lot of websites running on OpenCart don't load font awesome icons if you type an url address with www. If you omit www in the address, then it's ok. It happens with a lot of websites. What could cause that and how to avoid this?

For example:
http://www.demo.towerthemes.com/tt_autima/ (no icons on Windows)
http://demo.towerthemes.com/tt_autima/ (icons are ok here)

Newbie

Posts

Joined
Wed Mar 29, 2017 12:42 am

Post by kestas » Fri Feb 01, 2019 4:36 am

use .htaccess and force non www.

Code: Select all

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

Custom OpenCart modules and solutions. You can write PM with additional questions... Extensions you can find here


Active Member

Posts

Joined
Tue Oct 12, 2010 2:23 am

Post by IP_CAM » Fri Feb 01, 2019 7:11 am

And this one will make it work, regardless of using www or not:

Code: Select all

<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
I use it, to have my Style + JS Links made cookiefree
in the header.tpl (or header.twig) Files.
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by rtl7 » Fri Feb 01, 2019 11:53 pm

IP_CAM wrote:
Fri Feb 01, 2019 7:11 am

Code: Select all

<FilesMatch "\.(ttf|ttc|otf|eot|woff|font.css|css)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
I confirm that the solution did its job :)

Newbie

Posts

Joined
Wed Mar 29, 2017 12:42 am

Post by IP_CAM » Sat Feb 02, 2019 9:14 am

Good for you !
By the way, I found a nice Assortment of most important OC .htaccess 'Routines'
on Github, and placed the Forklink on my Github Main Page, named: htaccess-rules
it might be of help for those, looking for Code, including an explanation on what it does. :-)
But don't just add them 'all together' onto an .htaccess File, or your Shopsite will go mad !
https://github.com/IP-CAM
Good Luck!
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland
Who is online

Users browsing this forum: No registered users and 288 guests