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,

link|improve this question

feedback

1 Answer

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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