0

I have installed magento2 in one of our windows server which uses IIS. Followed the following blog, which helped for most part http://blog.winhost.com/how-to-install-magento-2-1-2-on-winhost-iis/ I ran all the commands that is needed. Ran the main command as well php bin/magento setup:static-content:deploy However, when i run my application on browser. The css and js will return in 404 error. Here are the few files that gets loaded. /pub/static/version1483704562/frontend/Magento/luma/en_US/mage/calendar.css Failed to load resource: the server responded with a status of 404 (Not Found) pub/static/version1483704562/frontend/Magento/luma/en_US/mage/requirejs/mixins.js Failed to load resource: the server responded with a status of 404 (Not Found) Here, if you notice. version1483704562 this version gets added up in URL. Not sure why this occur. The files are actually present, because of this version inclusion it throws error. Please let me know on how to solve this. NOTE: Application is in windows IIS server

2 Answers 2

0

IIS convert static folder to Application and create web config file with following rule

        <rules>
            <rule name="Imported Rule 1-1" stopProcessing="true">
                <match url="^version.+?/(.+)$" ignoreCase="false" />
                <action type="Rewrite" url="{R:1}" />
            </rule>
            <rule name="Imported Rule 2" stopProcessing="true">
                <match url=".*" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Rewrite" url="../static.php?resource={R:0}" appendQueryString="false" />
            </rule>
0

The version inclusion that you have mentioned is not the reason why css and js links throws an error. Static content signing is a Magento feature that allows you to invalidate the browser cache for static resources. Magento accomplishes this by adding a deployment version to the URL of static files . For additional info refer to [Magento DevDocs][1] Possible resolution for this issue( js and css throwing 404 not found) : - Make sure upgrade command has been executed ( php bin/magento setup:upgrade ) before deploying static content. [1]: https://devdocs.magento.com/guides/v2.3/config-guide/cache/static-content-signing.html#static-content-signing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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