Welcome to WebmasterWorld Guest from 54.196.175.173

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Mod_Rewrite Reassurances

Simple example, what to expect

     

brotherhood of LAN

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

WebmasterWorld Administrator brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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?

andreasfriedrich

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

WebmasterWorld Senior Member 10+ Year Member



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).

[httpd.apache.org...]

Andreas

brotherhood of LAN

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

WebmasterWorld Administrator brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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 :)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month