Through a lot of searching I finally found I could replace the + sign in the old URL with ([^.%]), using RewriteRule to do the redirecting. That worked with all the other URLs except the one above, which has a special character (%25, the substitution for %) in the middle. I assume that’s what’s throwing everything off, since the apostrophe has converted well in other URLs.
How do I account for that special character in the redirect statement in htaccess? I can’t change it since it was the old URL for the page, but I do need to redirect it.
I’m assuming 18 is an ID, and so is unique, i.e. this URL is the only URL on your site that starts with /_apps/water_faqs/reviews_details.php/18/ ?
If so, there is no need to match the complete URL. You could also just match /_apps/water_faqs/reviews_details.php/18/ and lose the $ at the end of your regex like so:
You’re quite right, that is a unique ID when I looked at it within the old site files. However, the code as you wrote it does not work either. But at least it’s given me a trail/idea to follow.
Could you post your complete .htaccess? Maybe there is some other rule interfering with this one.
Also, I just saw you have the [NC] option added to the RewriteRule. Feel free to drop that one, as it has no effect on that particular rule whatsoever, but causes some overhead (so just leave [L,R=301]).
[NC] is typically only used for case insensitive %{HTTP_HOST} comparison, and since an URL typically is case sensitive, [NC] is not needed.
Otherwise, without the ? in the code, it will take the new URL and tack on “?page=[the_OLD_URL]” as below, replacing the apostrophe and adding in the percent symbol without entity encoding:
I do understand that RedirectMatch makes use of standard regular expressions unlike Redirect, but the URL above and what I have read elsewhere indicated that it was useful for redirecting folders to a single page.
I don’t pretend to be expert or have extensive knowledge of htaccess. That’s why I’m here… to learn.
And thank you for your help, it really did help to put me on a better track with some answers, even if they are not perfect. I just haven’t got to the final solution yet, and greatly appreciate the assistance you’ve given.
So the same you had, but without the trailing ? and it works fine for me. I guess there is something in the .htaccess or in your PHP appending the ?page= stuff.