Open Sidlegionair opened 4 years ago
Note for grooming: Check possible connection with #22
Reproduced on local installation under Flywheel + Bedrock
The root cause is related to get_home_path()
which brings the /
path.
Based on Bedrock documents, it seems that .htaccess file needs to be located under: web/.htaccess
and this is the issue.
WP Rocket uses $htaccess_file = get_home_path() . '.htaccess';
which will identify the path to .htaccess file as : /.htaccess
which is not accurate.
UPDATE: IT seems this is only from CLI due to wrong ABSPATH coming from Bedrock
The issue is coming from this line:
$home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
from get_home_path()
-> file.php WP class
From CLI it seems that SCRIPT_FILENAME
= usr/bin/local/wp
which will break totally the home_path and also our htaccess path.
A possible solution is that from CLI to map the get_home_path() without any SCRIPT_FILENAME and modify also flush_rocket_htaccess()
function to accept the full path to htaccess file and bypass the default get_home_path()
@wp-media/php what do you think? Did I missed something?
Effort [S]
@Sidlegionair @crystinutzaa Can you retry this issue with v1.2 of the CLI?
One of the changes to fix #22 Could be also fixing this issue.
Hi,
The regeneration command does not work when running bedrock (https://roots.io/bedrock). It fails to detect the correct htaccess path from CLI and then it will stop to work here (htaccess.php line 33)