Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've moved all of my files from the root of my website into a subfolder, I'd like to do an Apache redirect to point to the files without affecting the other subfolders in my site.

E.g.
/index.html -- redirect to --> /subfolder1/index.html
/file1.html -- redirect to --> /subfolder1/index.html

/subfolder2/index.html -- No redirect

Can anyone help me with the redirect rule that I need to write for this. Thanks,

share|improve this question
add comment

1 Answer 1

Something like this would be a start

RewriteRule ^/([^/]*)$ /subfolder1/index.html [R]

It says that any request with only one / in it, will be redirected, anything with two / will not match the rule, so will be passed over.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.