I have a file .conf
in my server apache with the redirects and I want to redirect a url with parameters. An example is this:
https://example.com/presente/decoracao/teu-sorriso?PageSpeed=noscript
I need to redirect this to the same page, as in the example below:
https://example.com/presente/decoracao/teu-sorriso
In my .conf
file, I try the following code without success:
RedirectMatch 301 /presente/decoracao/teu-sorriso$ /presente/decoracao/teu-sorriso?
I can not use redirects from .htaccess
nor the Apache RewriteRule
method.Even researching, researching and trying, so far nothing has worked out. Thanks in advance!
You can not redirect a URL with
query string
usingRedirect
directive as it doesn't match against?PageSpeed=noscript
. You need to useMod-rewrite
.Assuming
mod-rewrite
module is enabled on your server , you can use something like the following in your Apache config or htaccess