Home > front end >  How to rewrite URLs that cause duplicate content?
How to rewrite URLs that cause duplicate content?

Time:05-03

I have a lot of links with a double URL structure. Basically, I need a .htaccess rule that redirects all URLs that start /de (for German language) to the same URL with only a /.

example.com/de/Shop/Tradition/Jagd-Forst/ 

to

example.com/Shop/Tradition/Jagd-Forst/

CodePudding user response:

Your rewrite rule should match starting with /de/ (with an optional strating slash, capture everything afterwards with (.*) and redirect to the capture group ($1) with a 301 permanent redirect:

RewriteEngine on
RewriteRule ^/?de/(.*) /$1 [R=301,L]
  • Related