RedirectMatch 301 Removing URL Parameters

前端 未结 1 421
长情又很酷
长情又很酷 2021-01-24 00:12

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/pre         


        
相关标签:
1条回答
  • 2021-01-24 00:30

    You can not redirect a URL with query string using Redirect directive as it doesn't match against ?PageSpeed=noscript . You need to use Mod-rewrite .

    Assuming mod-rewrite module is enabled on your server , you can use something like the following in your Apache config or htaccess

    RewriteEngine on
    
    RewriteCond %{QUERY_STRING} ^PageSpeed=noscript$ [NC]
    RewriteRule ^/?presente/decoracao/teu-sorriso/?$ /presente/decoracao/teu-sorriso? [L,R=301]
    
    0 讨论(0)
提交回复
热议问题