Skip to content

404 on theme's assets, wrong path/URL #789

@alexandre-tobia

Description

@alexandre-tobia

HI @leonstafford,

When generating static website, all of my static assets are not generated because of 404.

I've added logging line on your Crawler.php (L205) for showing the real URL used by the "getUrl" function:

if ( $response['code'] === 404 ) {
      $site_path = rtrim( SiteInfo::getURL( 'site' ), '/' );
      $url_slug = str_replace( $site_path, '', $url );
      WsLog::l( '404 for URL ' . $url_slug );

      WsLog::l( 'REAL URL ' . $url ); <===== HERE

      CrawlCache::rmUrl( $url_slug );
      $response['body'] = null;
  } elseif ( in_array( $response['code'], WP2STATIC_REDIRECT_CODES ) ) {
      $response['body'] = null;
  }

My wordpress site info:

site_path /Users/alexandretobia/Sites/nps/web/wp/
site_url http://nps.test/wp/
home_url http://nps.test/
includes_path /Users/alexandretobia/Sites/nps/web/wp/wp-includes/
includes_url http://nps.test/wp/wp-includes/
content_path /Users/alexandretobia/Sites/nps/web/app/
content_url http://nps.test/app/
uploads_path /Users/alexandretobia/Sites/nps/web/app/uploads/
uploads_url http://nps.test/app/uploads/
plugins_path /Users/alexandretobia/Sites/nps/web/app/plugins/
plugins_url http://nps.test/app/plugins/
themes_root_path /Users/alexandretobia/Sites/nps/web/app/themes/
themes_root_url http://nps.test/app/themes/
parent_theme_path /Users/alexandretobia/Sites/nps/web/app/themes/nps-wp/resources/
parent_theme_url http://nps.test/app/themes/nps-wp/resources/
child_theme_path /Users/alexandretobia/Sites/nps/web/app/themes/nps-wp/resources/
child_theme_url http://nps.test/app/themes/nps-wp/resources/

LOGS :
2021-06-08 13:01:58: REAL URL http://nps.test/Users/alexandretobia/Sites/nps/web/app/themes/nps-wp/resources/assets/styles/main.css
2021-06-08 13:01:58: 404 for URL /Users/alexandretobia/Sites/nps/web/app/themes/nps-wp/resources/assets/styles/main.css
2021-06-08 13:01:58: REAL URL http://nps.test/Users/alexandretobia/Sites/nps/web/app/themes/nps-wp/resources/assets/scripts/main.js
2021-06-08 13:01:58: 404 for URL /Users/alexandretobia/Sites/nps/web/app/themes/nps-wp/resources/assets/scripts/main.js
2021-06-08 13:01:58: REAL URL http://nps.test/Users/alexandretobia/Sites/nps/web/app/themes/nps-wp/resources/assets/mix-manifest.json
2021-06-08 13:01:58: 404 for URL /Users/alexandretobia/Sites/nps/web/app/themes/nps-wp/resources/assets/mix-manifest.json

I don't know why is he calling url like "http://nps.test/Users/alexandretobia/Sites/nps/web/app/themes/nps-wp/resources/assets/scripts/main.js"

Capture d’écran 2021-06-08 à 13 03 36

And a folder with "/Users/"...is created with corrupted files.

PHP version: 7.4.18
I'm using bedrock (roots.io)

Can you help me with that ?

Thanks a lot

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions