We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Question mark in image URL?

I am urlencoding my image names and all goes well unless there is a question mark in image.

Example:

https://example.com/public/images/bob_timm.jpg -- WORKS

https://example.com/public/images/ralph_testtext%3F.jpg -- REDIRECTS

Anyone know why it is redirecting instead of showing the image?

EDIT: The redirection is caused by the ACL. The real error is: "ImagesController handler class cannot be loaded."



33.8k

I cannot see nothing, I get only a Example domain warning. Whatever, it looks like:

1) You don't have a ImagesController controller created, or you haven't include it in the right controllers directory.

2) You didn't autoload the controllers directory.

After writting that, I really don't think so that the error is one of the above ('cause of the first working URL).



10.4k

Yes, none of those would make a difference since the other images work, just not the one that has a question mark in it (%3F).



98.9k

This rule in your .htaccess checks if the file exists and if not it sends the request to Phalcon:

AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f #Check if the file does exist and serve it
    RewriteRule ^(.*)$ index.php?_url=$1 [QSA,L]
</IfModule>

So probably, the web server is transforming the request from https://example.com/public/images/ralph_testtext%3F.jpg to https://example.com/public/images/ralph_testtext?.jpg which is handled completely different