Update htaccess to include rewrite rules for non-existing files and directories
This commit is contained in:
@@ -769,6 +769,11 @@ class S
|
||||
$htaccess_data );
|
||||
}
|
||||
|
||||
$htaccess_data .= PHP_EOL;
|
||||
$htaccess_data .= 'RewriteCond %{REQUEST_FILENAME} !-f' . PHP_EOL;
|
||||
$htaccess_data .= 'RewriteCond %{REQUEST_FILENAME} !-d' . PHP_EOL;
|
||||
$htaccess_data .= 'RewriteRule ^ index.php [L]';
|
||||
|
||||
$fp = fopen( $dir . '.htaccess', 'w' );
|
||||
fwrite( $fp, $htaccess_data );
|
||||
fclose( $fp );
|
||||
|
||||
@@ -103,7 +103,7 @@ if ( $request_uri != '' )
|
||||
$pattern = $route['pattern'];
|
||||
$destination = $route['destination'];
|
||||
|
||||
if ( preg_match("#^" . $pattern . "#", $request_uri, $matches ) )
|
||||
if ( preg_match( "#^" . $pattern . "#", $request_uri, $matches ) )
|
||||
{
|
||||
// Replace placeholders in the destination with matches from the request URI
|
||||
$destination = preg_replace( "#^" . $pattern . "#", $destination, $request_uri );
|
||||
|
||||
Reference in New Issue
Block a user