2

I have installed Magento 2.2 on hosted server (rewrite mod is on) and I have since 2 days a problem with .css file.

First of all, I deactivated on MYSQL static sign - "dev/static/sign => 0", so I don't have any "version15...." folder on /pub/static/.

I have cleaned all cache files and deploy all the things, what magento needs:

rm -rf var/view_preprocessed/ var/cache/ var/page_cache/ var/tmp/ var/generation/ pub/static/frontend/
php bin/magento cache:flush 
php bin/magento indexer:reindex 
php bin/magento setup:upgrade 
php bin/magento setup:db-data:upgrade 
php bin/magento dev:source-theme:deploy 
php bin/magento setup:static-content:deploy 

If I launch my page on firefox, I see that Magento want access to https://www.at-handel.at/pub/static/adminhtml/Magento/backend/en_US/extjs/resources/css/ext-all.css

I checked the path and it's correct. I have ext-all.css file on this path, but Firefox/Internet Explorer/Safari don't show me. It's not only on frontend, it's also on backend - https://www.at-handel.at/arkaplan
I have also checked the permissons on /var or /pub/static/ - 755

What can I do now??? Please help me.

1

On Ubuntu 16.04, using apache2 I was also facing the same issue.

Activated the mod_rewrite module with

sudo a2enmod rewrite

and restarted the apache with

sudo service apache2 restart

My issue resolved.

0

Firstly, static files signing tells browsers if there are changes on the website page and instructs them to refresh their saved caches. So, it's better to leave it on. Though, not sure if it works that way on developer mode.

I presume your Magento is set to Developer mode. You don't need to run

setup:static-content:deploy 

On Developer mode. Just refresh the page several times and symlinks to css/js/images/etc in pub/static/... will be created automatically.

I had a problem with css not taking effect once, it was very persistent and drove me nuts. In the end, it turned out to be browser cache. Try fully clearing your browser caches.

Make sure your css file is located in the path you have given in the css link. Place your css links in default_head_blocks.xml like:

<css src="Vendor_Modulename::css/magicmenu.css" /> <--this css will be located in app\code\Vendor\Modulename\view\frontend\web\css
<css src="css/styles.css" /> <--this css will be located in app\design\frontend\Vendor\themename\web\css
  • Thank you for your answer! I cleared my browser cache and also I have installed another browser (Chrome) and tested - no css! I don't know why I don't see any css -.- – mertrem Dec 23 '17 at 9:48
  • Please, see my updated answer. Are you sure you have given correct file path in your css links? – Iveta Allogenes Dec 23 '17 at 19:51
  • By the way, is this Magento localhost installation? Or is it deployed on live server? – Iveta Allogenes Dec 23 '17 at 19:53
0

Please check if your host supports all htaccess rules; i faced this problem before and my problem solved with rewriting

<Files>

rules in pub htaccess folder and it’s worked For example

<Files RELEASE_NOTES.txt>
        <IfVersion < 2.4>
            order allow,deny
            deny from all
        </IfVersion>
        <IfVersion >= 2.4>
            Require all denied
        </IfVersion>
</Files>

To

<Files RELEASE_NOTES.txt>
            order allow,deny
            deny from all
    </Files>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.