0

I have a double slash in several of my URLs. I've fixed the problem that was causing the double slashes. But now I want to add 301 redirects so Google/Bing etc. know which is the correct page version. I attempted this with the htaccess rule, but my rule doesn't seem to be working. Anything wrong with this htaccess rule? Here it is,

RedirectMatch 301 ^//(.*)$ https://www.example.com/$1

and this is an example of the URL I'm trying to match,

https://www.example.com//faq/

I want this to redirect to,

https://www.example.com/faq/

One thing I noticed was that when I type this URL,

https://www.example.com//faq

It seems to work. Have I written the rule wrong? I'm not the best with these!

Amit Verma
  • 40,709
  • 21
  • 93
  • 115
Vance
  • 1

1 Answers1

0

Please check this rewrite rule:

RewriteEngine On
RewriteRule ^\/(.*)$ https://www.example.com/$1 [R=301,L]
JarekBaran
  • 1,311
  • 2
  • 7
  • 12