A very strange problem. I've some .htaccess 301 redirects that aren't working plus some which are. They are within the same file, on a single server.

Here's one which works:

RewriteRule ^Email-2 Email-2.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*Email-2\.php\ HTTP/
RewriteRule ^(([^/]+/)*)Email-2\.php$ http://www.myserver.com/myfolder/Email-2$1 [R=301,L]

And here's one which does not work...

RewriteRule ^finance-step2 finance-step2.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*finance-step2\.php\ HTTP/
RewriteRule ^(([^/]+/)*)finance-step2\.php$ http://www.myserver.com/myfolder/finance-step2$1 [R=301,L]

I've 30+ of those redirects, and also the only ones that do not work appear to become the -step2, -step3, etc. The rest of the ones do.

I made use of Live HTTP Headers in Opera also it appears that Apache just isn't delivering the 301 code with those that aren't effective, but it's delivering the 301 on those that do.

I am pretty savvy with .htaccess and regex, but that one has me stumped. Any ideas?

May I request you to definitely perform some optimisation like: And that which was the HTTP/ in the finish from the RewriteCond? I have took it off:

RewriteRule ^(Email-2|finance-step2) $1.php [QSA]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*(Email-2|finance-step2)\.php
RewriteRule ^(([^/]+/)*)(Email-2|finance-step2)\.php$ http://www.myserver.com/myfolder/$2$1 [R=301,QSA,L]

One factor that's really strange: you initially redirect aa to aa.php then you definitely redirect aa.php to http://www.myserver.com/myfolder/aa. What exactly was the purpose of adding .php?

Let me know if the works