Answer the question
In order to leave comments, you need to log in
Apache removes slashes
I keep a small QR encoder at http://qr.nizarium.com/ .
In theory, it should encode everything that is in the query string :
http://qr.nizarium.com/what-you-want-to-encode / => http://qr.nizarium.com/http%3A%2F%2Fhabrahabr.ru%2F => http:/habrahabr.ru/
This turns the site address into a non-working one after recognition.
Blame it on Apache. It removes "extra" slashes even if they are encoded in urlencode. The found way to process the query string also does not work:
RewriteCond %{THE_REQUEST} ^[a-zA-Z]+\ ([^\ ]+)\ HTTP/
RewriteRule .* index.php?q=%1 [L]
I don't want to translate under /?q=…. How can I get back the missing slashes? Answer the question
In order to leave comments, you need to log in
> I don't want to translate under /?q=…. How can I get back the missing slashes?
write a rewrite.
RewriteCond %{THE_REQUEST} ^[a-zA-Z]+\ ([^\ ]+)\ HTTP/ RewriteRule .* index.php?q=%1 [L]
RewriteRule ^(.*)$ index.php?q=$1 [QSA, L]
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ index.php?q=$1 [QSA,L]
> RewriteCond %{REQUEST_URI} !^/$? it is necessary so that there is no cyclic redirection
. Without this, it works fine for me, it does not cycle. After the first redirect, the browser accesses an already existing file and, accordingly, the rule RewriteCond %{REQUEST_FILENAME} !-f
will no longer work.
I have Apache 2.0. Perhaps, indeed, in the first and it works differently. Unfortunately, there is no place to check it yourself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question