homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Mod_Rewrite Reassurances
Simple example, what to expect
brotherhood of LAN

 7:49 am on Dec 30, 2002 (gmt 0)

Hi all,

Very new to the URL re-writing etc, know a little regexp......

I have these 2 lines in an .htaccess file (on Apache server / winXP)

RewriteEngine on
RewriteRule ^user [localhost...]

The intention is to supply the content at default.htm to any request to the user folder. It seems to work fine on my platform/setup; for that I'm glad :)

I'd just like to know what URL any public viewer would see when they access something in the /user folder....reassurance if you will!

Am I right in thinking that this is all server side and no User Agent would know what's going on with the content switching here?

As far as any user is concerned they it will always appear that /user/whatever is the file being accessed?



 8:33 am on Dec 30, 2002 (gmt 0)

Yes, your code will only cause an internal redirect:

There is a special feature: When you prefix a substitution field with [thishost[:thisport]...] then mod_rewrite automatically strips it out. This auto-reduction on implicit external redirect URLs is a useful and important feature when used in combination with a mapping-function which generates the hostname part. Have a look at the first example in the example section below to understand this.
Remember: An unconditional external redirect to your own server will not work with the prefix [thishost...] because of this feature. To achieve such a self-redirect, you have to use the R-flag (see below).



brotherhood of LAN

 8:48 am on Dec 30, 2002 (gmt 0)

Thanks andreas

I'll probably use this for dynamic pages that merit a static looking page.

It seems easy enough, but also easy enough to mess it up in style :)

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved