View Single Post

  #8 (permalink)  
Old 10-28-2007
HansH
 
Posts: n/a
Default Re: mod_rewrite rules for live site

"shimmyshack" <matt.farey@gmail.com> schreef in bericht
news:1193575046.953037.299230@o3g2000hsb.googlegro ups.com...
> Your sites are just server aliases in that there is a single codebase,
> and therefore document root, you could use (and probably do ) within
> your vhost section
>
> Server mysite.com
> ServerAlias othersite.com
> ServerAlias yetanothersite.org
>
> this means that when it comes to keeping the files in separate folders
> you could have a handler for serving the files (which means that the
> files do not need to be in a public location on the webserver) ....

That's disliked by most if not all hosters: one will be ristrained at
best one level above the one document root.

> ... the handler.php script knows which host its on
> ($_SERVER['HTTP_HOST']) and can request the files from the location
> based on that.

:: snipped ::
> and there would be a single rewrite to point anything that started
> files
> ReWriteRule %{REQUEST_URI} ^files/(.*) /handler.php?filename=$1 [L]
> you then contain the logic in the php script, which you can change
> quickly and can add complexity to when required.

On static data I'ld rather not do myself what apache2 can do for me:
- set content-type, content-length and last-modified headers ao
- deflate on the fly
- and last but not least the performance advantage of sendfile.

> (I for instance use the handler script to mirror my content away from
> the server if busy / to switch to content distribution networks if
> one particular file gets a lot of hits, as well as to provide per user
> security, bandwidth shaping and concurrent download prevention)

Per user acces is the ONE reason to go through all hassle I dislike ...
.... That's why a script modifiing a rewritemap upon visitors logon|off
has been doing such for me - but that won't do in .htaccess anyway-

In total you're playing quite another ballgame, seems you're way beyond
virtual hosting -or use it beyond limits too ;-) -

HansH