I want the htaccess Redirect 301 to do the following using regex:
to
The 3 objectives of new URL are
-
delete /folder/
-
replace all _ with –
-
replace htm with shtml
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Best I’m aware, your point #2 cannot be done without a RewriteMap, which requires some pesky configuration, or multiple rules.
This implementation should be generic and work for any number of underscores, but it’s expensive in that it might trigger many redirect (in fact, potentially enough to fire redirect errors in browsers if you’ve tons of underscores in your paths):
Alternatives include enumerating use-cases as needed, or (better, I suspect) rewriting the request to a perl or php script and doing the regexp_replace + redirect 301 from there.