S
S
Sergey2015-11-05 20:49:07
PHP
Sergey, 2015-11-05 20:49:07

Why does a 400 error occur when using the % symbol in a url?

Why does a 400 error occur when using the % symbol in a url?
Links as an example, you don't have to click ;)
http://www.main.com/test% returns:
Bad Request
Your browser sent a request that this server could not understand.
http://www.main.com/test%test gives:
400 Bad Request
nginx/1.7.4
If you use % after ? everything is fine

RewriteEngine on
Options All -Indexes

RewriteCond %{HTTP_HOST} ^main.com
RewriteRule (.*) http://www.main.com/$1 [R=301,L]

RewriteBase /
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^resource/(.*)$ resource/$1 [L]
RewriteRule ^.*$ [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2015-11-05
@chelovekmuravei

Doctor, when I do this, it hurts. - Don't do that

Because the special character .

S
Saboteur, 2015-11-05
@saboteur_kiev

% is a prefix that must be followed by a numeric character code.
? it is a separator between URL and parameters.
Read about special characters in URLs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question