404 Not found when querying URIs with encoded parameters

I am sure this is a problem with the Apache configuration, as it worked with a previous hosting provider with the same PHP / MySQL configuration. In my application, users can delete photos by going to the URI as follows:

http://example.com/my-account/remove-media/id/9/ret/my-account%252Fedit-album%252Fid%252F1

The paramater identifier is the identifier of the photo to be deleted, the ret parameter is the relative URL where the user should be redirected after deleting the photo, but after clicking on a link like this, I get 404 Not Found error with text:

Not Found

The requested URL /public/my-account/remove-media/id/9/ret/my-account/edit-album/id/1 was not found on this server.

Although it worked on my previous hosting provider, so I think this is just an easy Apache configuration problem?

One more thing: there is a htaccess file that changes the document root to / public:

RewriteEngine On

RewriteRule ^\.htaccess$ - [F]

RewriteCond %{REQUEST_URI} =""
RewriteRule ^.*$ /public/index.php [NC,L]

RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]

RewriteRule ^public/.*$ /public/index.php [NC,L]

htaccess MVC:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]
+3
1

, - AllowEncodedSlashes . , , .htaccess . , , .

.../ret/my-account%252Fedit-album%252Fid%252F1 -> .../ret/my-account/edit-album/id/1

/ret/part , ( ret - ).

+2

Source: https://habr.com/ru/post/1741419/


All Articles