RewriteRule ^[^/.]*$ new/$0
everytime i type mydomain.com/somepath/to/somewhere it throws 404
its supposed to translate to : mydomain.com/new/somepath/to/somewhere
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.
Lets parse your rule really quickly:Anchor at the start, matching anything that is not / or not any character, 0 or more times, anchor at the end.
In other words, it will never match anything, because
.matches anything (and thus [^.] doesn’t match anything).I think you meant:
This readsAnchor at the start, matching 0 or 1 / , followed by 1 or more of any character (saving this match for later), anchor at the end.
(The RewriteCond prevents rewriting things in the /new/ directory, as per Devin Ceartas’s answer. The [L] prevents any further redirects)