php - Rewrite live site front-end to subfolder (but not /admin) and nothing on localhost -


lots of info solves this, nothing quite crack yet.

the site has front-end (all in root basically), , admin panel living in /admin. basic stuff.

the site runs remotely on http://www.example.com , locally on http://foo

i want nothing locally redirected @ all.

on live server want front-end traffic redirected sub-folder /coming_soon no redirection on admin panel. client can start work in admin, public ever see content in /coming_soon. (plus guess admin login page, that's fine).

closest came was:

<ifmodule mod_rewrite.c>   rewritecond %{https} !=on   rewritecond %{http_host} !=foo   rewriterule ^$ /coming_soon [l] </ifmodule> 

but let me hit "real" front-end browsing directly http://www.example.com/index.php

your appreciated.

hopefully got question right^^ wasn't sure /admin part, should access or if possible no 1 or...but following take on problem:

rewriteengine on  #excludes host=foo , uri=/admin rewrite /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 location-directive , allow entering /admin 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 temporary rewrite = won't cached browsers target location. r=301 tell browsers save target /coming_soon right away.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -