elementor / elementor/wp2static
404 on theme's assets, wrong path/URL
- Dominant language
- PHP
- Stars
- 1.5k
- Forks
- 294
- PR merge metrics
- No merged PRs in 30d
Description
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:
```php
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"

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
Contributor guide
Assessment
This issue has not been assessed yet.