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!
Please check this rewrite rule:
RewriteEngine On
RewriteRule ^\/(.*)$ https://www.example.com/$1 [R=301,L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.