1

I have a website that has some pages have the same content in them.

Link 1 :

 http://abcxyz.com/abc/xyz/1233.html

Link 2 :

 http://abcxyz.com/xyz/1233.html

Two links above is one page. Now I want to redirect link 1 to link 2 with htaccess. But, there is a problem, abc in link 1 is not static. Some links are abc, some others are rpq , yklm...

Please help me.

Amit Verma
  • 40,709
  • 21
  • 93
  • 115
Johnny
  • 23
  • 4

1 Answers1

0

You can use this rule in your DOCUMENT_ROOT/.htaccess file:

RewriteEngine On

RewriteRule ^[^/]+/(xyz/.+?\.html)$ /$1 [L,NC,R=302]
anubhava
  • 761,203
  • 64
  • 569
  • 643
  • Thanks you for showing me that :D but the system says Thanks for the feedback! Once you earn a total of 15. – Johnny Sep 13 '15 at 14:30
  • @Johnny: To accept an answer you don't need 15 reps. You probably tried to upvote the answer. To accept you just need to click on **tick mark** which is just left of `share` link of my answer and it will turn green. Accepting an answer will give you 2 points as well. – anubhava Sep 13 '15 at 15:16