2

I try to redirect a special URL in .htaccess, as below:

Redirect 301 /aor/%e2%80%9d https://www.example.com/outlook-repair/

But this seems does not work. I try to add quotes, as follows:

Redirect 301 "/aor/%e2%80%9d" https://www.example.com/outlook-repair/

But also not work. Why?

1

Because the Redirect directive matches against the %-decoded URL-path. %e2%80%9d is a URL-encoded "closing curly quote" (U+201D: RIGHT DOUBLE QUOTATION MARK).

For example

Redirect 301 "/aor/”" https://www.example.com/outlook-repair/

You need to ensure your .htaccess file is saved with a UTF-8 encoding.

Reference:
https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirect


To specifically match against the %-encoded URL-path (or rather, the URL as requested by the client) then you would need to use mod_rewrite and check against THE_REQUEST server variable.

For example:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,7}\s/aor/%e2%80%9d\sHTTP
RewriteRule ^aor/ https://www.example.com/outlook-repair/ [R=301,L]

THE_REQUEST server variable contains the first line of the HTTP request headers as sent from the client. eg. A string of the form:

GET /aor/%e2%80%9d HTTP/1.1
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.