apache rewrite perils

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

apache rewrite perils

French, Shelane
So we are moving from a Mac 10.6 server (Lasso 8.5, Apache 2.2.24) to a
RHEL 6 box (Lasso 8.6, Apache 2.2.15-31).

There are two rewrite rules that I have working on my Mac but are not
working on the Linux box:

RewriteCond %{REQUEST_URI}
^/students/science-on-saturday/(history|events)/[0-9]*$
                RewriteRule ^/(students/science-on-saturday)/(history|events)/([0-9]*)$
/index.lasso?q=$1/$2/&year=$3 [L,NS,PT,QSA]

                RewriteCond %{REQUEST_URI}
^/students/science-on-saturday/lecture/[0-9]*/?[a-z]*
                RewriteRule ^/(students/science-on-saturday/lecture)/([0-9]*)/?([a-z]*)$
/index.lasso?q=$1&topic=$2&detail=$3 [L,NS,PT,QSA]



Both of these end up failing and then going on to this rule:
RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.lasso?q=$1 [L,NS,PT,QSA]



So the action params end up being:

array: (pair: (-nothing)=()), (pair: (-operatorlogical)=(and)), (pair:
(-maxrecords)=(50)), (pair: (-skiprecords)=(0)), (pair: (-op)=(bw)),
(pair: (q)=(students/science-on-saturday/lecture/560))

This q should instead be students/science-on-saturday/lecture and it
should have topic=560 and another optional parameter (it may be something
like bio or description).

My server admin says he's not good with reg exp rewrites. Anyone have any
ideas? I have the rewrite log at 9 and it's so much stuff that it's not
helpful to me. I'm going to go to 4 and see if that's any better.
                                               


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: apache rewrite perils

stevepiercy
It would be best if you provided a few examples of URLs you want
to match so we can see the pattern against which you want to
match, and then the destination URL to which you want to rewrite
the request.

--steve


On 2/17/15 at 6:58 PM, [hidden email] (French, Shelane) pronounced:

>So we are moving from a Mac 10.6 server (Lasso 8.5, Apache 2.2.24) to a
>RHEL 6 box (Lasso 8.6, Apache 2.2.15-31).
>
>There are two rewrite rules that I have working on my Mac but are not
>working on the Linux box:
>
>RewriteCond %{REQUEST_URI}
>^/students/science-on-saturday/(history|events)/[0-9]*$
>RewriteRule ^/(students/science-on-saturday)/(history|events)/([0-9]*)$
>/index.lasso?q=$1/$2/&year=$3 [L,NS,PT,QSA]
>
>RewriteCond %{REQUEST_URI}
>^/students/science-on-saturday/lecture/[0-9]*/?[a-z]*
>RewriteRule ^/(students/science-on-saturday/lecture)/([0-9]*)/?([a-z]*)$
>/index.lasso?q=$1&topic=$2&detail=$3 [L,NS,PT,QSA]
>
>
>
>Both of these end up failing and then going on to this rule:
>RewriteCond %{REQUEST_FILENAME} !-f
>RewriteCond %{REQUEST_FILENAME} !-d
>RewriteRule ^(.*)$ /index.lasso?q=$1 [L,NS,PT,QSA]
>
>
>
>So the action params end up being:
>
>array: (pair: (-nothing)=()), (pair: (-operatorlogical)=(and)), (pair:
>(-maxrecords)=(50)), (pair: (-skiprecords)=(0)), (pair: (-op)=(bw)),
>(pair: (q)=(students/science-on-saturday/lecture/560))
>
>This q should instead be students/science-on-saturday/lecture and it
>should have topic=560 and another optional parameter (it may be something
>like bio or description).
>
>My server admin says he's not good with reg exp rewrites. Anyone have any
>ideas? I have the rewrite log at 9 and it's so much stuff that it's not
>helpful to me. I'm going to go to 4 and see if that's any better.
>
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.StevePiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: apache rewrite perils

French, Shelane
This is from my working site:

http://education.llnl.gov/students/science-on-saturday/history/2015
http://education.llnl.gov/students/science-on-saturday/history/2014

http://education.llnl.gov/students/science-on-saturday/lecture/561
http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
http://education.llnl.gov/students/science-on-saturday/lecture/538/outline

On 2/17/15, 11:39 AM, "Steve Piercy - Website Builder"
<[hidden email]> wrote:

It would be best if you provided a few examples of URLs you want
to match so we can see the pattern against which you want to
match, and then the destination URL to which you want to rewrite
the request.

--steve


On 2/17/15 at 6:58 PM, [hidden email] (French, Shelane) pronounced:

>So we are moving from a Mac 10.6 server (Lasso 8.5, Apache 2.2.24) to a
>RHEL 6 box (Lasso 8.6, Apache 2.2.15-31).
>
>There are two rewrite rules that I have working on my Mac but are not
>working on the Linux box:
>
>RewriteCond %{REQUEST_URI}
>^/students/science-on-saturday/(history|events)/[0-9]*$
>RewriteRule ^/(students/science-on-saturday)/(history|events)/([0-9]*)$
>/index.lasso?q=$1/$2/&year=$3 [L,NS,PT,QSA]
>
>RewriteCond %{REQUEST_URI}
>^/students/science-on-saturday/lecture/[0-9]*/?[a-z]*
>RewriteRule ^/(students/science-on-saturday/lecture)/([0-9]*)/?([a-z]*)$
>/index.lasso?q=$1&topic=$2&detail=$3 [L,NS,PT,QSA]
>
>
>
>Both of these end up failing and then going on to this rule:
>RewriteCond %{REQUEST_FILENAME} !-f
>RewriteCond %{REQUEST_FILENAME} !-d
>RewriteRule ^(.*)$ /index.lasso?q=$1 [L,NS,PT,QSA]
>
>
>
>So the action params end up being:
>
>array: (pair: (-nothing)=()), (pair: (-operatorlogical)=(and)), (pair:
>(-maxrecords)=(50)), (pair: (-skiprecords)=(0)), (pair: (-op)=(bw)),
>(pair: (q)=(students/science-on-saturday/lecture/560))
>
>This q should instead be students/science-on-saturday/lecture and it
>should have topic=560 and another optional parameter (it may be something
>like bio or description).
>
>My server admin says he's not good with reg exp rewrites. Anyone have any
>ideas? I have the rewrite log at 9 and it's so much stuff that it's not
>helpful to me. I'm going to go to 4 and see if that's any better.
>
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.StevePiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: apache rewrite perils

stevepiercy
Please try again.

> It would be best if you provided a few examples of URLs you want
> to match so we can see the pattern against which you want to
> match, ***and then the destination URL to which you want to rewrite
> the request.***

--steve


On 2/17/15 at 11:26 PM, [hidden email] (French, Shelane) pronounced:

> This is from my working site:
>
> http://education.llnl.gov/students/science-on-saturday/history/2015
> http://education.llnl.gov/students/science-on-saturday/history/2014
>
> http://education.llnl.gov/students/science-on-saturday/lecture/561
> http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
> http://education.llnl.gov/students/science-on-saturday/lecture/538/outline
>
> On 2/17/15, 11:39 AM, "Steve Piercy - Website Builder"
> <[hidden email]> wrote:
>
> It would be best if you provided a few examples of URLs you want
> to match so we can see the pattern against which you want to
> match, and then the destination URL to which you want to rewrite
> the request.
>
> --steve
>
>
> On 2/17/15 at 6:58 PM, [hidden email] (French, Shelane) pronounced:
>
> >So we are moving from a Mac 10.6 server (Lasso 8.5, Apache 2.2.24) to a
> >RHEL 6 box (Lasso 8.6, Apache 2.2.15-31).
> >
> >There are two rewrite rules that I have working on my Mac but are not
> >working on the Linux box:
> >
> >RewriteCond %{REQUEST_URI}
> >^/students/science-on-saturday/(history|events)/[0-9]*$
> >RewriteRule ^/(students/science-on-saturday)/(history|events)/([0-9]*)$
> >/index.lasso?q=$1/$2/&year=$3 [L,NS,PT,QSA]
> >
> >RewriteCond %{REQUEST_URI}
> >^/students/science-on-saturday/lecture/[0-9]*/?[a-z]*
> >RewriteRule ^/(students/science-on-saturday/lecture)/([0-9]*)/?([a-z]*)$
> >/index.lasso?q=$1&topic=$2&detail=$3 [L,NS,PT,QSA]
> >
> >
> >
> >Both of these end up failing and then going on to this rule:
> >RewriteCond %{REQUEST_FILENAME} !-f
> >RewriteCond %{REQUEST_FILENAME} !-d
> >RewriteRule ^(.*)$ /index.lasso?q=$1 [L,NS,PT,QSA]
> >
> >
> >
> >So the action params end up being:
> >
> >array: (pair: (-nothing)=()), (pair: (-operatorlogical)=(and)), (pair:
> >(-maxrecords)=(50)), (pair: (-skiprecords)=(0)), (pair: (-op)=(bw)),
> >(pair: (q)=(students/science-on-saturday/lecture/560))
> >
> >This q should instead be students/science-on-saturday/lecture and it
> >should have topic=560 and another optional parameter (it may be something
> >like bio or description).
> >
> >My server admin says he's not good with reg exp rewrites. Anyone have any
> >ideas? I have the rewrite log at 9 and it's so much stuff that it's not
> >helpful to me. I'm going to go to 4 and see if that's any better.
> >
> >
> >
> >#############################################################
> >
> >This message is sent to you because you are subscribed to
> >the mailing list Lasso [hidden email]
> >Official list archives available at http://www.lassotalk.com
> >To unsubscribe, E-mail to: <[hidden email]>
> >Send administrative queries to  <[hidden email]>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy              Website Builder              Soquel, CA
> <[hidden email]>               <http://www.StevePiercy.com/>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.StevePiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: apache rewrite perils

French, Shelane
This is from my working site:

http://education.llnl.gov/students/science-on-saturday/history/2015
http://education.llnl.gov/students/science-on-saturday/history/2014

I want to break it into:
if it begins with /students/science-on-saturday
Next is either history or events
Last is a 4 digit year

This request:
http://education.llnl.gov/students/science-on-saturday/history/2015


Should be rewritten as
/index.lasso?q=students/science-on-saturday/history&year=2015

So my root index.lasso page gets those params, includes my proper history
page, that then searches events from 2015

These requests:

http://education.llnl.gov/students/science-on-saturday/lecture/561
http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
http://education.llnl.gov/students/science-on-saturday/lecture/538/outline

Should be rewritten as
/index.lasso?q=students/science-on-saturday/lecture&topic=561
/index.lasso?q=students/science-on-saturday/lecture&topic=561&detail=bios
/index.lasso?q=students/science-on-saturday/lecture&topic=538&detail=outlin
e

My index.lasso lasso page would include my proper lecture page, search on
the topic number and display the correct detail tab (if provided) or
default tab.


The rewrite log is showing that it's not matching on the rules as I listed
below.



On 2/17/15, 4:00 PM, "Steve Piercy - Website Builder"
<[hidden email]> wrote:

Please try again.

> It would be best if you provided a few examples of URLs you want
> to match so we can see the pattern against which you want to
> match, ***and then the destination URL to which you want to rewrite
> the request.***

--steve


On 2/17/15 at 11:26 PM, [hidden email] (French, Shelane) pronounced:

> This is from my working site:
>
> http://education.llnl.gov/students/science-on-saturday/history/2015
> http://education.llnl.gov/students/science-on-saturday/history/2014
>
> http://education.llnl.gov/students/science-on-saturday/lecture/561
> http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
>
>http://education.llnl.gov/students/science-on-saturday/lecture/538/outline
>
> On 2/17/15, 11:39 AM, "Steve Piercy - Website Builder"
> <[hidden email]> wrote:
>
> It would be best if you provided a few examples of URLs you want
> to match so we can see the pattern against which you want to
> match, and then the destination URL to which you want to rewrite
> the request.
>
> --steve
>
>
> On 2/17/15 at 6:58 PM, [hidden email] (French, Shelane) pronounced:
>
> >So we are moving from a Mac 10.6 server (Lasso 8.5, Apache 2.2.24) to a
> >RHEL 6 box (Lasso 8.6, Apache 2.2.15-31).
> >
> >There are two rewrite rules that I have working on my Mac but are not
> >working on the Linux box:
> >
> >RewriteCond %{REQUEST_URI}
> >^/students/science-on-saturday/(history|events)/[0-9]*$
> >RewriteRule ^/(students/science-on-saturday)/(history|events)/([0-9]*)$
> >/index.lasso?q=$1/$2/&year=$3 [L,NS,PT,QSA]
> >
> >RewriteCond %{REQUEST_URI}
> >^/students/science-on-saturday/lecture/[0-9]*/?[a-z]*
> >RewriteRule ^/(students/science-on-saturday/lecture)/([0-9]*)/?([a-z]*)$
> >/index.lasso?q=$1&topic=$2&detail=$3 [L,NS,PT,QSA]
> >
> >
> >
> >Both of these end up failing and then going on to this rule:
> >RewriteCond %{REQUEST_FILENAME} !-f
> >RewriteCond %{REQUEST_FILENAME} !-d
> >RewriteRule ^(.*)$ /index.lasso?q=$1 [L,NS,PT,QSA]
> >
> >
> >
> >So the action params end up being:
> >
> >array: (pair: (-nothing)=()), (pair: (-operatorlogical)=(and)), (pair:
> >(-maxrecords)=(50)), (pair: (-skiprecords)=(0)), (pair: (-op)=(bw)),
> >(pair: (q)=(students/science-on-saturday/lecture/560))
> >
> >This q should instead be students/science-on-saturday/lecture and it
> >should have topic=560 and another optional parameter (it may be
>something
> >like bio or description).
> >
> >My server admin says he's not good with reg exp rewrites. Anyone have
>any
> >ideas? I have the rewrite log at 9 and it's so much stuff that it's not
> >helpful to me. I'm going to go to 4 and see if that's any better.
> >
> >
> >
> >#############################################################
> >
> >This message is sent to you because you are subscribed to
> >the mailing list Lasso [hidden email]
> >Official list archives available at http://www.lassotalk.com
> >To unsubscribe, E-mail to: <[hidden email]>
> >Send administrative queries to  <[hidden email]>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy              Website Builder              Soquel, CA
> <[hidden email]>               <http://www.StevePiercy.com/>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.StevePiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: apache rewrite perils

Bil Corry-3
You might add the NC flag to the conditionals to make them case-insensitive.

The rewrite log should indicate why the conditional isn't matching.  But
looking at the rule that did work, it appears %{REQUEST_URI} does not
contain a leading slash, so maybe try omitting them from the match, e.g.:

   RewriteCond %{REQUEST_URI}  ^students/science-on-saturday
/(history|events)/[0-9]*$
   RewriteRule ^(students/science-on-saturday)/(history|events)/([0-9]*)$
 /index.lasso?q=$1/$2/&year=$3
[L,NS,NC,PT,QSA]

Also, my rewrite-foo is a bit rusty, but I don't think you need RewriteCond,
you can probably omit it and just use the RewriteRules with the L flag.


- Bil

On Wed, Feb 18, 2015 at 1:46 AM, French, Shelane <[hidden email]> wrote:

> This is from my working site:
>
> http://education.llnl.gov/students/science-on-saturday/history/2015
> http://education.llnl.gov/students/science-on-saturday/history/2014
>
> I want to break it into:
> if it begins with /students/science-on-saturday
> Next is either history or events
> Last is a 4 digit year
>
> This request:
> http://education.llnl.gov/students/science-on-saturday/history/2015
>
>
> Should be rewritten as
> /index.lasso?q=students/science-on-saturday/history&year=2015
>
> So my root index.lasso page gets those params, includes my proper history
> page, that then searches events from 2015
>
> These requests:
>
> http://education.llnl.gov/students/science-on-saturday/lecture/561
> http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
> http://education.llnl.gov/students/science-on-saturday/lecture/538/outline
>
> Should be rewritten as
> /index.lasso?q=students/science-on-saturday/lecture&topic=561
> /index.lasso?q=students/science-on-saturday/lecture&topic=561&detail=bios
> /index.lasso?q=students/science-on-saturday/lecture&topic=538&detail=outlin
> e
>
> My index.lasso lasso page would include my proper lecture page, search on
> the topic number and display the correct detail tab (if provided) or
> default tab.
>
>
> The rewrite log is showing that it's not matching on the rules as I listed
> below.
>
>
>
> On 2/17/15, 4:00 PM, "Steve Piercy - Website Builder"
> <[hidden email]> wrote:
>
> Please try again.
>
> > It would be best if you provided a few examples of URLs you want
> > to match so we can see the pattern against which you want to
> > match, ***and then the destination URL to which you want to rewrite
> > the request.***
>
> --steve
>
>
> On 2/17/15 at 11:26 PM, [hidden email] (French, Shelane) pronounced:
>
> > This is from my working site:
> >
> > http://education.llnl.gov/students/science-on-saturday/history/2015
> > http://education.llnl.gov/students/science-on-saturday/history/2014
> >
> > http://education.llnl.gov/students/science-on-saturday/lecture/561
> > http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
> >
> >
> http://education.llnl.gov/students/science-on-saturday/lecture/538/outline
> >
> > On 2/17/15, 11:39 AM, "Steve Piercy - Website Builder"
> > <[hidden email]> wrote:
> >
> > It would be best if you provided a few examples of URLs you want
> > to match so we can see the pattern against which you want to
> > match, and then the destination URL to which you want to rewrite
> > the request.
> >
> > --steve
> >
> >
> > On 2/17/15 at 6:58 PM, [hidden email] (French, Shelane) pronounced:
> >
> > >So we are moving from a Mac 10.6 server (Lasso 8.5, Apache 2.2.24) to a
> > >RHEL 6 box (Lasso 8.6, Apache 2.2.15-31).
> > >
> > >There are two rewrite rules that I have working on my Mac but are not
> > >working on the Linux box:
> > >
> > >RewriteCond %{REQUEST_URI}
> > >^/students/science-on-saturday/(history|events)/[0-9]*$
> > >RewriteRule ^/(students/science-on-saturday)/(history|events)/([0-9]*)$
> > >/index.lasso?q=$1/$2/&year=$3 [L,NS,PT,QSA]
> > >
> > >RewriteCond %{REQUEST_URI}
> > >^/students/science-on-saturday/lecture/[0-9]*/?[a-z]*
> > >RewriteRule ^/(students/science-on-saturday/lecture)/([0-9]*)/?([a-z]*)$
> > >/index.lasso?q=$1&topic=$2&detail=$3 [L,NS,PT,QSA]
> > >
> > >
> > >
> > >Both of these end up failing and then going on to this rule:
> > >RewriteCond %{REQUEST_FILENAME} !-f
> > >RewriteCond %{REQUEST_FILENAME} !-d
> > >RewriteRule ^(.*)$ /index.lasso?q=$1 [L,NS,PT,QSA]
> > >
> > >
> > >
> > >So the action params end up being:
> > >
> > >array: (pair: (-nothing)=()), (pair: (-operatorlogical)=(and)), (pair:
> > >(-maxrecords)=(50)), (pair: (-skiprecords)=(0)), (pair: (-op)=(bw)),
> > >(pair: (q)=(students/science-on-saturday/lecture/560))
> > >
> > >This q should instead be students/science-on-saturday/lecture and it
> > >should have topic=560 and another optional parameter (it may be
> >something
> > >like bio or description).
> > >
> > >My server admin says he's not good with reg exp rewrites. Anyone have
> >any
> > >ideas? I have the rewrite log at 9 and it's so much stuff that it's not
> > >helpful to me. I'm going to go to 4 and see if that's any better.
> > >
> > >
> > >
> > >#############################################################
> > >
> > >This message is sent to you because you are subscribed to
> > >the mailing list Lasso [hidden email]
> > >Official list archives available at http://www.lassotalk.com
> > >To unsubscribe, E-mail to: <[hidden email]>
> > >Send administrative queries to  <[hidden email]>
> >
> > -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> > Steve Piercy              Website Builder              Soquel, CA
> > <[hidden email]>               <http://www.StevePiercy.com/>
> >
> >
> > #############################################################
> >
> > This message is sent to you because you are subscribed to
> >   the mailing list Lasso [hidden email]
> > Official list archives available at http://www.lassotalk.com
> > To unsubscribe, E-mail to: <[hidden email]>
> > Send administrative queries to  <[hidden email]>
> >
> >
> > #############################################################
> >
> > This message is sent to you because you are subscribed to
> >   the mailing list Lasso [hidden email]
> > Official list archives available at http://www.lassotalk.com
> > To unsubscribe, E-mail to: <[hidden email]>
> > Send administrative queries to  <[hidden email]>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy              Website Builder              Soquel, CA
> <[hidden email]>               <http://www.StevePiercy.com/>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>   the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>
>

#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: apache rewrite perils

stevepiercy
In reply to this post by French, Shelane
First, I don't think a RewriteCond directive is needed.  Compare
its usage against RewriteRule.
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

See below for more.

On 2/18/15 at 12:46 AM, [hidden email] (French, Shelane) pronounced:

>This is from my working site:
>
>http://education.llnl.gov/students/science-on-saturday/history/2015
>http://education.llnl.gov/students/science-on-saturday/history/2014
>
>I want to break it into:
>if it begins with /students/science-on-saturday
>Next is either history or events
>Last is a 4 digit year

I think this is the regex you seek.
https://regex101.com/r/zO9kT5/1

>This request:
>http://education.llnl.gov/students/science-on-saturday/history/2015
>
>
>Should be rewritten as
>/index.lasso?q=students/science-on-saturday/history&year=2015
>
>So my root index.lasso page gets those params, includes my proper history
>page, that then searches events from 2015

...and with it applied in your rewrite, try this.

RewriteRule
^\/students\/science-on-saturday\/(history|events)\/(\d{4})
/index.lasso?q=students/science-on-saturday/history&year=$2 [NC,L]

Note the above substitution assumes that both 'history' and
'events' shall be replaced with 'history', else use $1.

RewriteRule
^\/students\/science-on-saturday\/(history|events)\/(\d{4})
/index.lasso?q=students/science-on-saturday/$1&year=$2 [NC,L]

>These requests:
>
>http://education.llnl.gov/students/science-on-saturday/lecture/561
>http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
>http://education.llnl.gov/students/science-on-saturday/lecture/538/outline
>
>Should be rewritten as
>/index.lasso?q=students/science-on-saturday/lecture&topic=561
>/index.lasso?q=students/science-on-saturday/lecture&topic=561&detail=bios
>/index.lasso?q=students/science-on-saturday/lecture&topic=538&detail=outlin
>e

For topics, you might need to adjust the number of repetitions
of a digit.  The following will match 1-4 digits, or the
integers 0-9999.  You need two rewrite rules, one without and
one with the detail get parameter.

RewriteRule
^\/students\/science-on-saturday\/lecture\/(\d{1,4})$
/index.lasso?q=students/science-on-saturday/lecture&topic=$1 [NC,L]

RewriteRule
^\/students\/science-on-saturday\/lecture\/(\d{1,4})\/(.*)
/index.lasso?q=students/science-on-saturday/lecture&topic=$1&detail=$2
[NC,L]

--steve

>My index.lasso lasso page would include my proper lecture page, search on
>the topic number and display the correct detail tab (if provided) or
>default tab.
>
>
>The rewrite log is showing that it's not matching on the rules as I listed
>below.
>
>
>
>On 2/17/15, 4:00 PM, "Steve Piercy - Website Builder"
><[hidden email]> wrote:
>
>Please try again.
>
>>It would be best if you provided a few examples of URLs you want
>>to match so we can see the pattern against which you want to
>>match, ***and then the destination URL to which you want to rewrite
>>the request.***
>
>--steve
>
>
>On 2/17/15 at 11:26 PM, [hidden email] (French, Shelane) pronounced:
>
>>This is from my working site:
>>
>>http://education.llnl.gov/students/science-on-saturday/history/2015
>>http://education.llnl.gov/students/science-on-saturday/history/2014
>>
>>http://education.llnl.gov/students/science-on-saturday/lecture/561
>>http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
>>
>>http://education.llnl.gov/students/science-on-saturday/lecture/538/outline
>>
>>On 2/17/15, 11:39 AM, "Steve Piercy - Website Builder"
>><[hidden email]> wrote:
>>
>>It would be best if you provided a few examples of URLs you want
>>to match so we can see the pattern against which you want to
>>match, and then the destination URL to which you want to rewrite
>>the request.
>>
>>--steve
>>
>>
>>On 2/17/15 at 6:58 PM, [hidden email] (French, Shelane) pronounced:
>>
>>>So we are moving from a Mac 10.6 server (Lasso 8.5, Apache 2.2.24) to a
>>>RHEL 6 box (Lasso 8.6, Apache 2.2.15-31).
>>>
>>>There are two rewrite rules that I have working on my Mac but are not
>>>working on the Linux box:
>>>
>>>RewriteCond %{REQUEST_URI}
>>>^/students/science-on-saturday/(history|events)/[0-9]*$
>>>RewriteRule ^/(students/science-on-saturday)/(history|events)/([0-9]*)$
>>>/index.lasso?q=$1/$2/&year=$3 [L,NS,PT,QSA]
>>>
>>>RewriteCond %{REQUEST_URI}
>>>^/students/science-on-saturday/lecture/[0-9]*/?[a-z]*
>>>RewriteRule ^/(students/science-on-saturday/lecture)/([0-9]*)/?([a-z]*)$
>>>/index.lasso?q=$1&topic=$2&detail=$3 [L,NS,PT,QSA]
>>>
>>>
>>>
>>>Both of these end up failing and then going on to this rule:
>>>RewriteCond %{REQUEST_FILENAME} !-f
>>>RewriteCond %{REQUEST_FILENAME} !-d
>>>RewriteRule ^(.*)$ /index.lasso?q=$1 [L,NS,PT,QSA]
>>>
>>>
>>>
>>>So the action params end up being:
>>>
>>>array: (pair: (-nothing)=()), (pair: (-operatorlogical)=(and)), (pair:
>>>(-maxrecords)=(50)), (pair: (-skiprecords)=(0)), (pair: (-op)=(bw)),
>>>(pair: (q)=(students/science-on-saturday/lecture/560))
>>>
>>>This q should instead be students/science-on-saturday/lecture and it
>>>should have topic=560 and another optional parameter (it may be
>>something
>>>like bio or description).
>>>
>>>My server admin says he's not good with reg exp rewrites. Anyone have
>>any
>>>ideas? I have the rewrite log at 9 and it's so much stuff that it's not
>>>helpful to me. I'm going to go to 4 and see if that's any better.
>>>
>>>
>>>
>>>#############################################################
>>>
>>>This message is sent to you because you are subscribed to
>>>the mailing list Lasso [hidden email]
>>>Official list archives available at http://www.lassotalk.com
>>>To unsubscribe, E-mail to: <[hidden email]>
>>>Send administrative queries to  <[hidden email]>
>>
>>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>Steve Piercy              Website Builder              Soquel, CA
>><[hidden email]>               <http://www.StevePiercy.com/>
>>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>the mailing list Lasso [hidden email]
>>Official list archives available at http://www.lassotalk.com
>>To unsubscribe, E-mail to: <[hidden email]>
>>Send administrative queries to  <[hidden email]>
>>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>the mailing list Lasso [hidden email]
>>Official list archives available at http://www.lassotalk.com
>>To unsubscribe, E-mail to: <[hidden email]>
>>Send administrative queries to  <[hidden email]>
>
>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>Steve Piercy              Website Builder              Soquel, CA
><[hidden email]>               <http://www.StevePiercy.com/>
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.StevePiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: apache rewrite perils

French, Shelane
Thank you Bil and Steve. I am using just the rule now, made the digit fix,
and removed the leading / (which has caught me before and I don't know why
I missed it again!!) and all is working!

On 2/18/15, 1:06 AM, "Steve Piercy - Website Builder"
<[hidden email]> wrote:

First, I don't think a RewriteCond directive is needed.  Compare
its usage against RewriteRule.
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

See below for more.

On 2/18/15 at 12:46 AM, [hidden email] (French, Shelane) pronounced:

>This is from my working site:
>
>http://education.llnl.gov/students/science-on-saturday/history/2015
>http://education.llnl.gov/students/science-on-saturday/history/2014
>
>I want to break it into:
>if it begins with /students/science-on-saturday
>Next is either history or events
>Last is a 4 digit year

I think this is the regex you seek.
https://regex101.com/r/zO9kT5/1

>This request:
>http://education.llnl.gov/students/science-on-saturday/history/2015
>
>
>Should be rewritten as
>/index.lasso?q=students/science-on-saturday/history&year=2015
>
>So my root index.lasso page gets those params, includes my proper history
>page, that then searches events from 2015

...and with it applied in your rewrite, try this.

RewriteRule
^\/students\/science-on-saturday\/(history|events)\/(\d{4})
/index.lasso?q=students/science-on-saturday/history&year=$2 [NC,L]

Note the above substitution assumes that both 'history' and
'events' shall be replaced with 'history', else use $1.

RewriteRule
^\/students\/science-on-saturday\/(history|events)\/(\d{4})
/index.lasso?q=students/science-on-saturday/$1&year=$2 [NC,L]

>These requests:
>
>http://education.llnl.gov/students/science-on-saturday/lecture/561
>http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
>http://education.llnl.gov/students/science-on-saturday/lecture/538/outline
>
>Should be rewritten as
>/index.lasso?q=students/science-on-saturday/lecture&topic=561
>/index.lasso?q=students/science-on-saturday/lecture&topic=561&detail=bios
>/index.lasso?q=students/science-on-saturday/lecture&topic=538&detail=outli
>n
>e

For topics, you might need to adjust the number of repetitions
of a digit.  The following will match 1-4 digits, or the
integers 0-9999.  You need two rewrite rules, one without and
one with the detail get parameter.

RewriteRule
^\/students\/science-on-saturday\/lecture\/(\d{1,4})$
/index.lasso?q=students/science-on-saturday/lecture&topic=$1 [NC,L]

RewriteRule
^\/students\/science-on-saturday\/lecture\/(\d{1,4})\/(.*)
/index.lasso?q=students/science-on-saturday/lecture&topic=$1&detail=$2
[NC,L]

--steve

>My index.lasso lasso page would include my proper lecture page, search on
>the topic number and display the correct detail tab (if provided) or
>default tab.
>
>
>The rewrite log is showing that it's not matching on the rules as I listed
>below.
>
>
>
>On 2/17/15, 4:00 PM, "Steve Piercy - Website Builder"
><[hidden email]> wrote:
>
>Please try again.
>
>>It would be best if you provided a few examples of URLs you want
>>to match so we can see the pattern against which you want to
>>match, ***and then the destination URL to which you want to rewrite
>>the request.***
>
>--steve
>
>
>On 2/17/15 at 11:26 PM, [hidden email] (French, Shelane) pronounced:
>
>>This is from my working site:
>>
>>http://education.llnl.gov/students/science-on-saturday/history/2015
>>http://education.llnl.gov/students/science-on-saturday/history/2014
>>
>>http://education.llnl.gov/students/science-on-saturday/lecture/561
>>http://education.llnl.gov/students/science-on-saturday/lecture/561/bios
>>
>>http://education.llnl.gov/students/science-on-saturday/lecture/538/outlin
>>e
>>
>>On 2/17/15, 11:39 AM, "Steve Piercy - Website Builder"
>><[hidden email]> wrote:
>>
>>It would be best if you provided a few examples of URLs you want
>>to match so we can see the pattern against which you want to
>>match, and then the destination URL to which you want to rewrite
>>the request.
>>
>>--steve
>>
>>
>>On 2/17/15 at 6:58 PM, [hidden email] (French, Shelane) pronounced:
>>
>>>So we are moving from a Mac 10.6 server (Lasso 8.5, Apache 2.2.24) to a
>>>RHEL 6 box (Lasso 8.6, Apache 2.2.15-31).
>>>
>>>There are two rewrite rules that I have working on my Mac but are not
>>>working on the Linux box:
>>>
>>>RewriteCond %{REQUEST_URI}
>>>^/students/science-on-saturday/(history|events)/[0-9]*$
>>>RewriteRule ^/(students/science-on-saturday)/(history|events)/([0-9]*)$
>>>/index.lasso?q=$1/$2/&year=$3 [L,NS,PT,QSA]
>>>
>>>RewriteCond %{REQUEST_URI}
>>>^/students/science-on-saturday/lecture/[0-9]*/?[a-z]*
>>>RewriteRule ^/(students/science-on-saturday/lecture)/([0-9]*)/?([a-z]*)$
>>>/index.lasso?q=$1&topic=$2&detail=$3 [L,NS,PT,QSA]
>>>
>>>
>>>
>>>Both of these end up failing and then going on to this rule:
>>>RewriteCond %{REQUEST_FILENAME} !-f
>>>RewriteCond %{REQUEST_FILENAME} !-d
>>>RewriteRule ^(.*)$ /index.lasso?q=$1 [L,NS,PT,QSA]
>>>
>>>
>>>
>>>So the action params end up being:
>>>
>>>array: (pair: (-nothing)=()), (pair: (-operatorlogical)=(and)), (pair:
>>>(-maxrecords)=(50)), (pair: (-skiprecords)=(0)), (pair: (-op)=(bw)),
>>>(pair: (q)=(students/science-on-saturday/lecture/560))
>>>
>>>This q should instead be students/science-on-saturday/lecture and it
>>>should have topic=560 and another optional parameter (it may be
>>something
>>>like bio or description).
>>>
>>>My server admin says he's not good with reg exp rewrites. Anyone have
>>any
>>>ideas? I have the rewrite log at 9 and it's so much stuff that it's not
>>>helpful to me. I'm going to go to 4 and see if that's any better.
>>>
>>>
>>>
>>>#############################################################
>>>
>>>This message is sent to you because you are subscribed to
>>>the mailing list Lasso [hidden email]
>>>Official list archives available at http://www.lassotalk.com
>>>To unsubscribe, E-mail to: <[hidden email]>
>>>Send administrative queries to  <[hidden email]>
>>
>>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>>Steve Piercy              Website Builder              Soquel, CA
>><[hidden email]>               <http://www.StevePiercy.com/>
>>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>the mailing list Lasso [hidden email]
>>Official list archives available at http://www.lassotalk.com
>>To unsubscribe, E-mail to: <[hidden email]>
>>Send administrative queries to  <[hidden email]>
>>
>>
>>#############################################################
>>
>>This message is sent to you because you are subscribed to
>>the mailing list Lasso [hidden email]
>>Official list archives available at http://www.lassotalk.com
>>To unsubscribe, E-mail to: <[hidden email]>
>>Send administrative queries to  <[hidden email]>
>
>-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>Steve Piercy              Website Builder              Soquel, CA
><[hidden email]>               <http://www.StevePiercy.com/>
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.StevePiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>