Home > database >  How to redirect index.php pages
How to redirect index.php pages

Time:01-13

How to redirect /index.php?route=blog/blog to /blog and index.php?route=information/contact to /contact

The site is on Opencart 2.3. I tried with:

RewriteRule ^index.php?route=blog/blog$ /blog [R=301,L]

I've come to the point where pages open in both ways, but don't redirect.

CodePudding user response:

You can't match against query string (anything that goes after ? in URL) in pattern of a RewriteRule . You need to match against %{QUERY_STRING} variable using a RewriteCond directive

RewriteEngine On

RewriteCond %{QUERY_STRING} ^route=[^/] /(. )$ [NC]
RewriteRule ^ /%1? [L,R=301]

CodePudding user response:

After adding these 3 lines, comment to the product page is not displayed. Is there another solution to the problem?

  •  Tags:  
  • Related