You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Rob Wilkerson <r....@gmail.com> on 2006/06/28 15:15:06 UTC

[users@httpd] mod_rewrite Scenario Assistance

First let me say that I hope this is the proper mailing list for my
question.  If that's not the case, please redirect me and I'll be
happy to post there.

I'm taking over an application that currently includes an Apache
module written to redirect web traffic to one or more virtual hosts.
In looking at what it does, I'm wondering whether I can accomplish the
same thing with mod_rewrite and not have to worry about:  1)
rebuilding the module for each version of Apache and 2) compiling for
multiple versions on multiple platforms (windows, linux, solaris -
currently).

Here's what the module does (and, consequently, what I need mod_rewrite to do):
1.  Operate within one or more virtual hosts, but not necessarily within others
2.  By default, redirect all incoming traffic to a single point of
entry (e.g. mylandingpage.php) which will then redirect as needed
3.  Forward the originally requested URL to the landing page (this is
the part that might be the killer).  Our current module writes a
request header with this info that is read by the landing page.
4.  Accept or allow a list of excluded directories which should *not*
be redirected.  For example, I have a directory "/se" which must be
delivered without first accessing the landing page.

The more I read, the more it seems like this might be accomplished
using mod_rewrite rather than a custom module, but I'd like some
confirmation from others with more experience than I have and, if
possible, a sample configuration that implements such a scenario.

Any insight, suggestions or assistance with this would be very much
appreciated.  Thank you.

Rob Wilkerson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite Scenario Assistance

Posted by Bill Jones <te...@gmail.com>.
On 6/28/06, Rob Wilkerson <r....@gmail.com> wrote:
> I'm taking over an application that currently includes an Apache
> module written to redirect web traffic to one or more virtual hosts.
> In looking at what it does, I'm wondering whether I can accomplish the
> same thing with mod_rewrite and not have to worry about:  1)
> rebuilding the module for each version of Apache and 2) compiling for
> multiple versions on multiple platforms (windows, linux, solaris -
> currently).

Is the source code for this module available?  Such a module may prove
interesting in other similar deployments.
-- 
WC (Bill) Jones -- http://youve-reached-the.endoftheinternet.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Rob Wilkerson <r....@gmail.com>.
I thought about that and may go that direction, but ease/simplicity of
adding "exclusions" is also a factor.  I may have to take a survey.
:-)

Thanks for all of your help.

On 7/6/06, Joshua Slive <jo...@slive.ca> wrote:
> On 7/6/06, Rob Wilkerson <r....@gmail.com> wrote:
> > Okay, thanks.  There doesn't seem to be any performance impact, but
> > this is a scaled down proof-of-concept implementation.  I assume that
> > before implementing that rule it's implementing all of the preceeding
> > rules.  Is there any reason I shouldn't move the /landingpage.cfm rule
> > to the top of the list?
>
> I don't see a problem with that.  If speed is a big concern, you can
> also combine a bunch of the regexes into one by |-ing the conditions.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 

Rob Wilkerson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Joshua Slive <jo...@slive.ca>.
On 7/6/06, Rob Wilkerson <r....@gmail.com> wrote:
> Okay, thanks.  There doesn't seem to be any performance impact, but
> this is a scaled down proof-of-concept implementation.  I assume that
> before implementing that rule it's implementing all of the preceeding
> rules.  Is there any reason I shouldn't move the /landingpage.cfm rule
> to the top of the list?

I don't see a problem with that.  If speed is a big concern, you can
also combine a bunch of the regexes into one by |-ing the conditions.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Rob Wilkerson <r....@gmail.com>.
Okay, thanks.  There doesn't seem to be any performance impact, but
this is a scaled down proof-of-concept implementation.  I assume that
before implementing that rule it's implementing all of the preceeding
rules.  Is there any reason I shouldn't move the /landingpage.cfm rule
to the top of the list?

On 7/6/06, Joshua Slive <jo...@slive.ca> wrote:
> On 7/6/06, Rob Wilkerson <r....@gmail.com> wrote:
> > Joshua -
> >
> > I have one quick follow-up question, if you don't mind.  I've
> > implemented the rules as shown below and have been watching the logs
> > and I notice that the /landingpage.cfm pattern is always being engaged
> > for /landingpage.cfm (even though I'm never calling that page
> > directly).  Does the redirection itself cause the rewrite rules to be
> > executed?
> >
> > Here is what I have:
> >
> >      RewriteEngine On
> >      RewriteLog  /var/log/httpd/rewrite_log
> >      RewriteLogLevel 3
> >
> >      RewriteRule ^/bfg                  -                       [L]
> >      RewriteRule ^/se                   -                       [L]
> >      RewriteRule ^/mod/modules/foo      -                       [L]
> >      RewriteRule ^/landingpage.cfm      -                       [L]
> >      RewriteRule ^/(.*)
> > /landingpage.cfm?uri=%{REQUEST_URI}     [QSA,PT]
>
> In some cases a subrequest is used to change to the new location,
> which will retrigger the RewriteRules.  I don't recall all the details
> of this, but it is less likely to happen if you omit the PT flag and
> also if you provide a full (file-system) path to landingpage.cfm.  But
> it shouldn't be a problem in any case.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 

Rob Wilkerson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Joshua Slive <jo...@slive.ca>.
On 7/6/06, Rob Wilkerson <r....@gmail.com> wrote:
> Joshua -
>
> I have one quick follow-up question, if you don't mind.  I've
> implemented the rules as shown below and have been watching the logs
> and I notice that the /landingpage.cfm pattern is always being engaged
> for /landingpage.cfm (even though I'm never calling that page
> directly).  Does the redirection itself cause the rewrite rules to be
> executed?
>
> Here is what I have:
>
>      RewriteEngine On
>      RewriteLog  /var/log/httpd/rewrite_log
>      RewriteLogLevel 3
>
>      RewriteRule ^/bfg                  -                       [L]
>      RewriteRule ^/se                   -                       [L]
>      RewriteRule ^/mod/modules/foo      -                       [L]
>      RewriteRule ^/landingpage.cfm      -                       [L]
>      RewriteRule ^/(.*)
> /landingpage.cfm?uri=%{REQUEST_URI}     [QSA,PT]

In some cases a subrequest is used to change to the new location,
which will retrigger the RewriteRules.  I don't recall all the details
of this, but it is less likely to happen if you omit the PT flag and
also if you provide a full (file-system) path to landingpage.cfm.  But
it shouldn't be a problem in any case.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Rob Wilkerson <r....@gmail.com>.
Joshua -

I have one quick follow-up question, if you don't mind.  I've
implemented the rules as shown below and have been watching the logs
and I notice that the /landingpage.cfm pattern is always being engaged
for /landingpage.cfm (even though I'm never calling that page
directly).  Does the redirection itself cause the rewrite rules to be
executed?

Here is what I have:

     RewriteEngine On
     RewriteLog  /var/log/httpd/rewrite_log
     RewriteLogLevel 3

     RewriteRule ^/bfg                  -                       [L]
     RewriteRule ^/se                   -                       [L]
     RewriteRule ^/mod/modules/foo      -                       [L]
     RewriteRule ^/landingpage.cfm      -                       [L]
     RewriteRule ^/(.*)
/landingpage.cfm?uri=%{REQUEST_URI}     [QSA,PT]

Thanks again.

On 7/2/06, Rob Wilkerson <r....@gmail.com> wrote:
> Sorry, by CGI variables, I meant the webserver variables.  Stored in
> the CGI scope by ColdFusion and in the SERVER[] scope in PHP, if that
> helps.  Variables like SCRIPT_NAME, HTTP_REFERER, etc.
>
> I tried your sample code against several use cases and it does
> everything our current module does and more.  I still have to test the
> webserver variables to know whether I have to pass the URL in the
> query string, but I think that should be a formality.
>
> Thanks again for all of your help.  Without it, this effort would have
> taken significantly longer than it did.  I appreciate that.
>
> On 7/1/06, Joshua Slive <jo...@slive.ca> wrote:
> > On 7/1/06, Rob Wilkerson <r....@gmail.com> wrote:
> > > Thanks, Joshua.  I'm glad I asked.  The ways I was planning to attempt
> > > would've been *far* more complex.  I had no idea it would be that
> > > simple.
> > >
> > > If I understand you correctly...mod_rewrite does *not* modify the CGI
> > > variables?  If not, then I probably don't have to pass anything along
> > > at all.  That, of course, would be ideal.
> >
> > If by "CGI variables" you mean the query string, then my example did,
> > in fact, change them.  But if you leave off the "?$1" they should be
> > left unchanged.  (Your script may need to look in
> > REDIRECT_QUERY_STRING.  That's why I suggest dumping all the variables
> > to see what is available.)
> >
> > >
> > > One last question (for now), if you don't mind: can you explain your
> > > last paragraph?  For me, local referrers still need redirection.  This
> > > is for a CMS that stores pages as data.  The "landing page" is
> > > actually a rendering engine that compiles and caches the data as a
> > > physical file.  I was trying to simplify the example scenario.  Even
> > > so, I'd like to understand what your final condition is doing.
> > > Specifically, the NC portion.  I believe the rest is checking the
> > > referring URL for anything that is not within the site I'm accessing
> > > and redirecting only then.
> >
> > I thought you mean langing page as in a page that you redirect
> > off-site visitors to when they first arrive.  You are correct it is
> > not needed in the scenario you describe.  NC stands for No Case,
> > meaning the test is case-insensitive.  Check the documentation for
> > RewriteCond.
> >
> > Joshua.
> >
> > ---------------------------------------------------------------------
> > The official User-To-User support forum of the Apache HTTP Server Project.
> > See <URL:http://httpd.apache.org/userslist.html> for more info.
> > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> >    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> > For additional commands, e-mail: users-help@httpd.apache.org
> >
> >
>
>
> --
>
> Rob Wilkerson
>


-- 

Rob Wilkerson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Rob Wilkerson <r....@gmail.com>.
Sorry, by CGI variables, I meant the webserver variables.  Stored in
the CGI scope by ColdFusion and in the SERVER[] scope in PHP, if that
helps.  Variables like SCRIPT_NAME, HTTP_REFERER, etc.

I tried your sample code against several use cases and it does
everything our current module does and more.  I still have to test the
webserver variables to know whether I have to pass the URL in the
query string, but I think that should be a formality.

Thanks again for all of your help.  Without it, this effort would have
taken significantly longer than it did.  I appreciate that.

On 7/1/06, Joshua Slive <jo...@slive.ca> wrote:
> On 7/1/06, Rob Wilkerson <r....@gmail.com> wrote:
> > Thanks, Joshua.  I'm glad I asked.  The ways I was planning to attempt
> > would've been *far* more complex.  I had no idea it would be that
> > simple.
> >
> > If I understand you correctly...mod_rewrite does *not* modify the CGI
> > variables?  If not, then I probably don't have to pass anything along
> > at all.  That, of course, would be ideal.
>
> If by "CGI variables" you mean the query string, then my example did,
> in fact, change them.  But if you leave off the "?$1" they should be
> left unchanged.  (Your script may need to look in
> REDIRECT_QUERY_STRING.  That's why I suggest dumping all the variables
> to see what is available.)
>
> >
> > One last question (for now), if you don't mind: can you explain your
> > last paragraph?  For me, local referrers still need redirection.  This
> > is for a CMS that stores pages as data.  The "landing page" is
> > actually a rendering engine that compiles and caches the data as a
> > physical file.  I was trying to simplify the example scenario.  Even
> > so, I'd like to understand what your final condition is doing.
> > Specifically, the NC portion.  I believe the rest is checking the
> > referring URL for anything that is not within the site I'm accessing
> > and redirecting only then.
>
> I thought you mean langing page as in a page that you redirect
> off-site visitors to when they first arrive.  You are correct it is
> not needed in the scenario you describe.  NC stands for No Case,
> meaning the test is case-insensitive.  Check the documentation for
> RewriteCond.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 

Rob Wilkerson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Joshua Slive <jo...@slive.ca>.
On 7/1/06, Rob Wilkerson <r....@gmail.com> wrote:
> Thanks, Joshua.  I'm glad I asked.  The ways I was planning to attempt
> would've been *far* more complex.  I had no idea it would be that
> simple.
>
> If I understand you correctly...mod_rewrite does *not* modify the CGI
> variables?  If not, then I probably don't have to pass anything along
> at all.  That, of course, would be ideal.

If by "CGI variables" you mean the query string, then my example did,
in fact, change them.  But if you leave off the "?$1" they should be
left unchanged.  (Your script may need to look in
REDIRECT_QUERY_STRING.  That's why I suggest dumping all the variables
to see what is available.)

>
> One last question (for now), if you don't mind: can you explain your
> last paragraph?  For me, local referrers still need redirection.  This
> is for a CMS that stores pages as data.  The "landing page" is
> actually a rendering engine that compiles and caches the data as a
> physical file.  I was trying to simplify the example scenario.  Even
> so, I'd like to understand what your final condition is doing.
> Specifically, the NC portion.  I believe the rest is checking the
> referring URL for anything that is not within the site I'm accessing
> and redirecting only then.

I thought you mean langing page as in a page that you redirect
off-site visitors to when they first arrive.  You are correct it is
not needed in the scenario you describe.  NC stands for No Case,
meaning the test is case-insensitive.  Check the documentation for
RewriteCond.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Rob Wilkerson <r....@gmail.com>.
Thanks, Joshua.  I'm glad I asked.  The ways I was planning to attempt
would've been *far* more complex.  I had no idea it would be that
simple.

If I understand you correctly...mod_rewrite does *not* modify the CGI
variables?  If not, then I probably don't have to pass anything along
at all.  That, of course, would be ideal.

One last question (for now), if you don't mind: can you explain your
last paragraph?  For me, local referrers still need redirection.  This
is for a CMS that stores pages as data.  The "landing page" is
actually a rendering engine that compiles and caches the data as a
physical file.  I was trying to simplify the example scenario.  Even
so, I'd like to understand what your final condition is doing.
Specifically, the NC portion.  I believe the rest is checking the
referring URL for anything that is not within the site I'm accessing
and redirecting only then.

Thanks again.  That really was an eye-opener for me.

On 7/1/06, Joshua Slive <jo...@slive.ca> wrote:
> On 7/1/06, Rob Wilkerson <r....@gmail.com> wrote:
> > I've gotten some great feedback on this question, but would still
> > really like to see some kind of example code to help me get started.
> > I suspect I'll need to use RewriteBase and RewriteCond in addition to
> > RewriteRule, but I'm not feeling all that confident in my, ahem,
> > analysis.
> >
> > In my case, for any given virtual host, I need everything to go to
> > landingpage.php *except* for requests to anything in /se or anything
> > in /bfg (both are aliases - Alias /se /opt/product/version/se).  Can
> > anyone throw together some simple directives to show me how I might
> > accomplish this?  I also need to pass along the original URL, but I
> > imagine I can work that out if I understand the first part well
> > enough.  The rewrite itself is where I think I'm most lost.
>
> You don't need RewriteBase unless you are using .htaccess files.  You
> can also avoid RewriteConf for a simple scenario like this:
>
> RewriteEngine On
> RewriteRule ^/bfg - [L]
> RewriteRule ^/se - [L]
> RewriteRule ^/landingpage.php - [L]
> RewriteRule ^/(.*) /landingpage.php?$1
>
> The first three rules are rewrite a path back to itself and then end
> processing.  The last RewriteRule does the real work.  I passed the
> original path in the query string, but it could also be passed as
> PATH_INFO or just fished out of the environment.  (Try dumping the
> entire environment in you landingpage.php and you should be able to
> pick out the original path someplace.)  Use the RewriteLog to debug.
>
> I suspect you also have another requirement that you didn't mention:
> the internal redirect to the landing page should happen only for
> requests that do not have local referers.  If so, you need to add
> RewriteCond %{HTTP_REFERER} !^http://mysite.com/ [NC]
> before the final RewriteRule.
>
> Joshua.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 

Rob Wilkerson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Joshua Slive <jo...@slive.ca>.
On 7/1/06, Rob Wilkerson <r....@gmail.com> wrote:
> I've gotten some great feedback on this question, but would still
> really like to see some kind of example code to help me get started.
> I suspect I'll need to use RewriteBase and RewriteCond in addition to
> RewriteRule, but I'm not feeling all that confident in my, ahem,
> analysis.
>
> In my case, for any given virtual host, I need everything to go to
> landingpage.php *except* for requests to anything in /se or anything
> in /bfg (both are aliases - Alias /se /opt/product/version/se).  Can
> anyone throw together some simple directives to show me how I might
> accomplish this?  I also need to pass along the original URL, but I
> imagine I can work that out if I understand the first part well
> enough.  The rewrite itself is where I think I'm most lost.

You don't need RewriteBase unless you are using .htaccess files.  You
can also avoid RewriteConf for a simple scenario like this:

RewriteEngine On
RewriteRule ^/bfg - [L]
RewriteRule ^/se - [L]
RewriteRule ^/landingpage.php - [L]
RewriteRule ^/(.*) /landingpage.php?$1

The first three rules are rewrite a path back to itself and then end
processing.  The last RewriteRule does the real work.  I passed the
original path in the query string, but it could also be passed as
PATH_INFO or just fished out of the environment.  (Try dumping the
entire environment in you landingpage.php and you should be able to
pick out the original path someplace.)  Use the RewriteLog to debug.

I suspect you also have another requirement that you didn't mention:
the internal redirect to the landing page should happen only for
requests that do not have local referers.  If so, you need to add
RewriteCond %{HTTP_REFERER} !^http://mysite.com/ [NC]
before the final RewriteRule.

Joshua.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: mod_rewrite Scenario Assistance

Posted by Rob Wilkerson <r....@gmail.com>.
I've gotten some great feedback on this question, but would still
really like to see some kind of example code to help me get started.
I suspect I'll need to use RewriteBase and RewriteCond in addition to
RewriteRule, but I'm not feeling all that confident in my, ahem,
analysis.

In my case, for any given virtual host, I need everything to go to
landingpage.php *except* for requests to anything in /se or anything
in /bfg (both are aliases - Alias /se /opt/product/version/se).  Can
anyone throw together some simple directives to show me how I might
accomplish this?  I also need to pass along the original URL, but I
imagine I can work that out if I understand the first part well
enough.  The rewrite itself is where I think I'm most lost.

Any similar config examples would be very much appreciated.

Thank you.

On 6/28/06, Rob Wilkerson <r....@gmail.com> wrote:
> First let me say that I hope this is the proper mailing list for my
> question.  If that's not the case, please redirect me and I'll be
> happy to post there.
>
> I'm taking over an application that currently includes an Apache
> module written to redirect web traffic to one or more virtual hosts.
> In looking at what it does, I'm wondering whether I can accomplish the
> same thing with mod_rewrite and not have to worry about:  1)
> rebuilding the module for each version of Apache and 2) compiling for
> multiple versions on multiple platforms (windows, linux, solaris -
> currently).
>
> Here's what the module does (and, consequently, what I need mod_rewrite to do):
> 1.  Operate within one or more virtual hosts, but not necessarily within others
> 2.  By default, redirect all incoming traffic to a single point of
> entry (e.g. mylandingpage.php) which will then redirect as needed
> 3.  Forward the originally requested URL to the landing page (this is
> the part that might be the killer).  Our current module writes a
> request header with this info that is read by the landing page.
> 4.  Accept or allow a list of excluded directories which should *not*
> be redirected.  For example, I have a directory "/se" which must be
> delivered without first accessing the landing page.
>
> The more I read, the more it seems like this might be accomplished
> using mod_rewrite rather than a custom module, but I'd like some
> confirmation from others with more experience than I have and, if
> possible, a sample configuration that implements such a scenario.
>
> Any insight, suggestions or assistance with this would be very much
> appreciated.  Thank you.
>
> Rob Wilkerson
>


-- 

Rob Wilkerson

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite Scenario Assistance

Posted by Joshua Slive <jo...@slive.ca>.
On 6/28/06, Rob Wilkerson <r....@gmail.com> wrote:
> First let me say that I hope this is the proper mailing list for my
> question.  If that's not the case, please redirect me and I'll be
> happy to post there.
>
> I'm taking over an application that currently includes an Apache
> module written to redirect web traffic to one or more virtual hosts.
> In looking at what it does, I'm wondering whether I can accomplish the
> same thing with mod_rewrite and not have to worry about:  1)
> rebuilding the module for each version of Apache and 2) compiling for
> multiple versions on multiple platforms (windows, linux, solaris -
> currently).
>
> Here's what the module does (and, consequently, what I need mod_rewrite to do):
> 1.  Operate within one or more virtual hosts, but not necessarily within others
> 2.  By default, redirect all incoming traffic to a single point of
> entry (e.g. mylandingpage.php) which will then redirect as needed
> 3.  Forward the originally requested URL to the landing page (this is
> the part that might be the killer).  Our current module writes a
> request header with this info that is read by the landing page.

What do you mean by "writes a request header"?  Is it proxying the
requests, or redirecting them?  It can't modify the client's request
headers if it is redirecting.

You can certainly do this easily by passing the original URL in the
query string, which would be visible to the client.  If that is
acceptable, then I don't see anything here that can't be done by
mod_rewrite.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org