将实时站点前端重写为子文件夹(但不是/ admin),并在localhost上重写

Lots of info nearly solves this, but nothing will quite crack it yet.

The site has a front-end (all in root basically), and an admin panel living in /admin. Basic stuff.

The site runs remotely on http://www.example.com and locally on http://foo

I want nothing locally redirected at all.

On the live server I just want front-end traffic redirected to a sub-folder /coming_soon but no redirection on the admin panel. So the client can start work in admin, but the public will only ever see the content in /coming_soon. (Plus I guess the admin login page, but that's fine).

Closest I came was:

<IfModule mod_rewrite.c>
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} !=foo
  RewriteRule ^$ /coming_soon [L]
</IfModule>

But that let me hit the "real" front-end by browsing directly to http://www.example.com/index.php

Your help much appreciated.

Hopefully I got your question right^^ Wasn't sure about the /admin part, who should access or if possible no one or...But the following is my take on your problem:

RewriteEngine On

#excludes HOST=foo and URI=/admin from rewrite to /coming_soon
RewriteCond %{HTTP_HOST} !^foo [OR]
RewriteCond %{REQUEST_URI} !^/admin
RewriteRule ^ http://www.example.com/coming_soon [R=301,L]

You can additionally set a location-directive and only allow entering /admin from specific IP(s).

<location /admin>
    required ip 10.11.12.13
    required ip 20.30.40.0/24
</location>

update

RewriteCond %{HTTP_HOST} !=foo
RewriteCond %{REQUEST_URI} !/(coming_soon|admin)
RewriteRule ^(.*)$ /coming_soon [R=302,L]

And R=302 is just temporary rewrite = won't be cached by browsers with target location. R=301 would tell browsers to save the target /coming_soon right away.

...if any one can improve this, or make it more elegant, I'd love to hear!

RewriteCond %{HTTP_HOST} !=foo
RewriteCond %{REQUEST_URI} !/coming_soon
RewriteCond %{REQUEST_URI} !/admin
RewriteRule ^(.*)$ /coming_soon [R=302,R]