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 was developing a site in a subfolder so the url was look like:

and these URLs have been indexed by search engines.

Now, I am looking for a general rule for .htaccess that can redirect all the URLs inside the /website folder to relevant pages on the main site. That is, should
redirect to: should
redirect to:

Can anybody help me here?

share|improve this question
RewriteEngine On
RewriteRule ^/website/(.+)$ /$1 [R=301,L,QSA]

Try that one out. Rewrites everything from /website/ to / with a 301 (Moved permanently) header

share|improve this answer

Your Answer


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.