dvoutt
dvoutt

Reputation: 950

htaccess - Some of my 301 redirects are working

Working on a website upgrade and upgrading a bunch of pages. I have these three RewriteRule's and one of them is not working. I'm novice to htaccess so I'm assuming I'm using the wrong syntax.

RewriteRule ^(.*)Accessibility/$ /$1accessibility/ [R=301,L]
RewriteRule ^(.*)Accessibility/Multi-Year-Plan/$ /$1accessibility/ [R=301,L]
RewriteRule ^(.*)Accessibility/Standard-Policy/$ /$1accessibility/standard-policy/ [R=301,L]

In the same order, this is what is working in my dev environment.

  1. Works
  2. Doesn't work
  3. Works

Thanks for the help.

Upvotes: 1

Views: 49

Answers (1)

anubhava
anubhava

Reputation: 786349

You can combine rule 1 and rule 2 into one then test:

RewriteRule ^(.*?)Accessibility(/Multi-Year-Plan)?/?$ /$1accessibility/ [R=301,L]
RewriteRule ^(.*)Accessibility/Standard-Policy/$ /$1accessibility/standard-policy/ [R=301,L]

Upvotes: 1

Related Questions