Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.htaccess SCRIPT_FILENAME doesn't read Ampersand '&' sign #21

Open
faizananwerali opened this issue Apr 20, 2020 · 0 comments
Open

.htaccess SCRIPT_FILENAME doesn't read Ampersand '&' sign #21

faizananwerali opened this issue Apr 20, 2020 · 0 comments

Comments

@faizananwerali
Copy link

.htaccess

RewriteEngine On

# Redirect images to webp-on-demand.php (if browser supports webp)
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME} [NC,L]

webp-on-demand.php

echo $source = $_GET['source'];

File Name:

B Tours & Travel Front Ad.jpg

URL:

 https://www.example.com/storage/upload_assets/B%20Tours%20%26%20Travel%20Front%20Ad.jpg
 https://www.example.com/storage/upload_assets/B%20Tours%20&%20Travel%20Front%20Ad.jpg

Error:

/home/visionph/example.com/public/storage/upload_assets/B Tours
Fatal error: Uncaught WebPConvert\Exceptions\InvalidInput\TargetNotFoundException: source file was not found in /home/visionph/example.com/vendor/rosell-dk/webp-convert/src/Helpers/PathChecker.php:71 
Stack trace: 
#0 /home/visionph/example.com/vendor/rosell-dk/webp-convert/src/Helpers/PathChecker.php(85): WebPConvert\Helpers\PathChecker::checkAbsolutePathAndExists('/home/visionph/...', 'source') 
#1 /home/visionph/example.com/vendor/rosell-dk/webp-convert/src/Helpers/InputValidator.php(47): WebPConvert\Helpers\PathChecker::checkSourcePath('/home/visionph/...') 
#2 /home/visionph/example.com/vendor/rosell-dk/webp-convert/src/Helpers/InputValidator.php(58): WebPConvert\Helpers\InputValidator::checkSource('/home/visionph/...') 
#3 /home/visionph/example.com/vendor/rosell-dk/webp-convert/src/Serve/ServeConvertedWebP.php(135): WebPConvert\Helpers\InputValidator::checkSourceAndDestination('/home/visionph/...', '/home/visionph/...') 
#4 /home/visionph/example.com/vendor/rosell-dk/ in /home/visionph/example.com/vendor/rosell-dk/webp-convert/src/Helpers/PathChecker.php on line 71
@faizananwerali faizananwerali changed the title .htaccess SCRIPT_FILENAME doesn't read Ampersand '&' .htaccess SCRIPT_FILENAME doesn't read Ampersand '&' sign Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant