Webmasters Stack Exchange is a question and answer site for pro webmasters. 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 asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name

Sorry for redirecting, but I wasn't aware of webmasters.stackoverflow and wasn't sure if I should repost it here or just link to it to prevent duplication.


Here's what I have so far:

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/(.+)$
RewriteRule /(.*) http://archived.example.com/$1

This is redirecting everything, including example.com alone. I only want the redirect to happen if there is something (anything) after the ".com" (i.e. "/whatever"). I have a static HTML page that is now at example.com, but I want my old DB-backed site to go to archived.example.com.

Anymore ideas?

share|improve this question
Don't duplicate questions. Ask that they be migrated. Requesting closure of the original over on SO. – Su' Dec 11 '11 at 20:01

This should work:

RewriteEngine On
RewriteCond ^/(.+)
RewriteRule /(.*) http://archived.example.com/$1
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.