I have:
https://Restoran.Grupacija.com/?ćumur
Which needs to be redirected to:
https://Restoran.Grupacija.com/
This directive is in .htaccess file in the Root Folder, but it does not work:
Redirect 301 "^/?ćumur" https://Restoran.Grupacija.com
I have also tried this, but it does not work either:
Redirect 301 "^/?ćumur" https://Restoran.Grupacija.com
My .htaccess file is UTF-8 already.
CodePudding user response:
The mod_alias Redirect
directive matches the URL-path only, which notably excludes the query string. (However, neither does the Redirect
directive match using a regex, it uses simple prefix-matching instead.)
To match the query string you need to use mod_rewrite instead and match against the QUERY_STRING
server variable in a RewriteCond
directive.
Note that the browser/user-agent will URL encode the ć
as ć
in the HTTP request and the QUERY_STRING
server variable is not %-decoded, so we need to match the encoded request. Strictly speaking, both