Web Servers on Unix and Linux - keep url in address bar

This is Interesting: Free IT Magazines  
Home > Archive > Web Servers on Unix and Linux > July 2004 > keep url in address bar





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author keep url in address bar
Cookie Monster

2004-07-01, 7:47 am

Hi,

I am using Apache 1.3 with mod_rewrite and would like to know if it is
possible to keep the original URL the user entered in the browser address
bar when performing a rewrite. For example:

RewriteRule ^/home /www/work/home.html [R]

When the user enters http://www.domain.com/home

What happens is they see http://www.domain.com/www/work/home.html in the
browser.

is there anyway to avoid this?? (I don't want to use frames either)

Thanks,
Cookie.


Claire Tucker

2004-07-01, 5:52 pm

On Thu, 1 Jul 2004 15:35:25 +0200, "Cookie Monster"
<cookie.monster@somewhere.com> wrote:

>Hi,
>
>I am using Apache 1.3 with mod_rewrite and would like to know if it is
>possible to keep the original URL the user entered in the browser address
>bar when performing a rewrite. For example:
>
>RewriteRule ^/home /www/work/home.html [R]
>
>When the user enters http://www.domain.com/home
>
>What happens is they see http://www.domain.com/www/work/home.html in the
>browser.
>
>is there anyway to avoid this?? (I don't want to use frames either)
>


The default with mod_rewrite is to internally redirect, meaning that
the client will not be aware that anything special has happened on the
server.

The [R] flag at the end of your RewriteRule directive is what is
causing it to send a redirect to the browser. If you remove it, it
should work as you want.

However, beware that any relative links in home.html will be resolved
relative to /home, not /www/work/home.html, so you will either need to
use absolute URLs or use a more general rewrite rule which will map
/([a-z]+)\.html$, being careful not to match the destination URL in
the RewriteRule!

Best regards,
-Claire
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com