View Single Post

  #3 (permalink)  
Old 02-20-2007
shimmyshack
 
Posts: n/a
Default Re: mod_rewrite and relative paths help

On 19 Feb, 11:39, Susanne West <s...@gmx.de> wrote:
> hi group.
>
> i've been using mod_rewrite for simple things so
> far and always encountered the same (basic) problem,
> which is, that relative paths get messed up.
>
> i was wondering if i'm doing something conceptionally wrong
> if i use the following setup:
>
> i have multiple (empty!) directories on my disk that i'd like
> to use as 'virtual' urls (e.g.):
>
> /about
> /products
> /detail
>
> as well as a special directory with a handler-script
> /frontend/handler.php
> that should be targeted by .htaccess-files in the directories
> above. so each directory listed contains a .htaccess file with
> the following (accordingly adapted) lines:
>
> RewriteEngine On
> RewriteBase /about/
> RewriteRule .* /frontend/handler.php?mode=about
> RewriteRule ^index.html$ /frontend/handler.php?mode=about
>
> is that a correct way to handle the overall situation?
> because the problem arises, when i'd like to additionally map an
> exception from another level of the path hierarchy, like mapping the
> actual homepage [/index.html] down to /frontend/handler.php?mode=home
> because obviously, then, the relative links to images, stylesheets etc
> are different and the page looks totally broken...
>
> how are you guys handling this?
>
> greets!


just in case that wasnt clear:

<Directory "/path/to/vhosts/server.com/public">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /frontend/handler.php [L,NS]
</Directory>