Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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.