Google does not have access to .js file

#46922
  • Resolved Charl Beetge
    Rank Math free

    I’m getting an error on ryte.com when analysing my site (otella.co.za) saying “Blocked JavaScript files”. The js file is “password-strength-meter.min.js”. I found a very old solution (2015 post) on the web saying to add
    User-Agent: Googlebot
    Allow: *.js
    Allow: *.css
    to the robot.txt file. At the same time, I see on Rank Math the robot.txt is a virtual file. Must I over right the robot.txt file to get Google to access the .js file?

    Regards – Charl

Viewing 3 replies - 1 through 3 (of 3 total)
  • Alberto
    Rank Math business

    Hello,

    I have just checked your website and there are two JS files called “password-strength-meter.min.js”: one from wp-admin/js and another one from wp-content/plugins/woocommerce/assets/js/frontend

    Since you have your robots.txt blocking every request from /wp-admin/*, it is normal ryte.com is telling you the file is blocked.

    But usually you should have blocked in your robots.txt the /wp-admin/* directories (you don’t want it to be indexed) so you have two options:

    • To move the file to another place like in wp-content. But it can be complicated, since it could generate several issues if another file depends on it
    • To allow that specific file in your robots.txt meanwhile disallowing any other in wp-admin/*

    To do the second option, you have to edit your robots.txt in the Rank Math plugin just as I show you in the following screenshot:
    allow js robots txt

    I have added below how your robots.txt should be after the edition:

    User-agent: *
    Disallow: /wp-admin/
    Allow: /wp-admin/admin-ajax.php
    Allow: /wp-admin/js/password-strength-meter.min.js
    
    Sitemap: https://otella.co.za/sitemap_index.xml

    Hope it helps. Let us know if you have any other questions.

    Thank you very much for the fantastic product and great support!!

    Alberto
    Rank Math business

    Hello Charl,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this ticket.