httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Owen Boyle <>
Subject Re: mod_rewrite IP -> URL
Date Tue, 18 Dec 2001 09:03:46 GMT
Kyle wrote:
> I'm pulling my hair out here, and I don't have much left.  Can anyone
> send me an example of how to change an IP to a URL on the user's
> browser?  In other words, user types in this:
> http://XXX.XXX.XXX.XXX/whatver
> and mod_rewrite does it's magic and the user's browser displays this in
> the address bar:
> Can mod_rewrite do this?  If so, I've been RTFMing all afternoon and I
> just don't see how to do it.  Any guidance would be greatly appreciated.

The page Joshua referred you to does indeed contain the solution you are
looking for although it is rather cryptically presented...

Notice that the page (and your posting) concentrate on the use of
mod_rewrite. However, the actual solution lies in the use of "redirect".
These two functions are very similar but the essential difference is
that mod_rewrite is entirely server-side so that any re-writing of the
URL is invisible to the browser and the browser will not change. When
you do a redirect on the other hand, the server replies to the original
request with a 301 or 302 redirect response which causes the browser to
re-issue its request (to the new URL) *and* change its location window
contents. Consider the following example:

RewriteRule  ^/(.*)$1

User types in:
Server fetches:
Browser displays:

RedirectMatch (.*)$1

User types in:
Server sends 301 ->
Browser requests:
User gets served:
Browser displays:

Read the docs on Redirect and RedirectMatch for the details...


Owen Boyle.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message