Announcement

Collapse
No announcement yet.

Fw: mod rewrite question for static urls - SOLVED!!! - not exactly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Fw: mod rewrite question for static urls - SOLVED!!! - not exactly



    ------=_NextPart_000_00DD_01C55C89.AEB8F8C0
    Content-Type: text/plain;
    charset="iso-8859-1"
    Content-Transfer-Encoding: quoted-printable

    I wanted to add a heads-up for anyone who wants to try this -- Although =
    I haven't yet encountered any problems with the rewrite of merchant.mvc =
    to static urls on the customer side, I have just determined that if =
    Merchant Optimizer builds new pages, it does this to the static URLs:

    http://storedomain.com/static/productname.html =3D> shows Apache "Moved =
    Permanently" screen and says, "The document has moved here." "Here" is =
    linked to:
    http://storedomain.com/static/produc...code=3Dsc.html

    So far, I've found that if I disable the rewrite code in httpd.conf =
    before I build pages with Merchant Optimizer, everything is okay. =
    However, any pages built while the rewrite code is enabled will result =
    in this problem.

    Amanda

    ----- Original Message -----=20
    From: Amanda P. - Miva List=20
    To: Kelly XR=20
    Cc: [email protected]=20
    Sent: Thursday, May 19, 2005 12:52 PM
    Subject: Re: [mru] mod rewrite question for static urls - SOLVED!!!


    Thanks for the tip, Kelly. I started out with the code that came with =
    the MO docs and it had both. I'll get rid of the redundant one.

    This is in the httpd.conf file. All the docs I saw about it said that =
    it would only work in the httpd.conf file, like you said yesterday.

    Amanda
    ----- Original Message -----=20
    From: Kelly XR=20
    To: Amanda P. - Miva List=20
    Cc: [email protected]=20
    Sent: Thursday, May 19, 2005 11:02 AM
    Subject: Re: [mru] mod rewrite question for static urls - SOLVED!!!


    Amanda...
    One tip... you don't need the second set of
    rewrite engine on and rewritemap to lower int:tolower..
    You only need to turn on the rewrite engine once... once it is on, =
    it's on.
    same with the map you only need to do that once.

    Kelly


    Amanda P. - Miva List wrote:

    >I absolutely cannot believe this. I figured this out, somehow.
    >
    >Thanks, Kelly - I used your lead, read through some docs and =
    examples, and got lucky guessing on the syntax.=20
    >
    >This is what works (beautifully!):
    >
    >RewriteEngine On
    >rewritemap tolower int:tolower=20
    >RewriteCond ${tolower:%{QUERY_STRING}} Category_Code=3D(.*)& [NC]
    >RewriteRule ^(.*) http://storedomain.com/static/%1.html? [R,L]
    >RewriteCond ${tolower:%{QUERY_STRING}} Category_Code=3D(.*)$ [NC]
    >RewriteRule ^(.*) http://storedomain.com/static/%1.html? [R,L]
    >RewriteEngine On
    >rewritemap tolower int:tolower=20
    >RewriteCond ${tolower:%{QUERY_STRING}} Product_Code=3D(.*)& [NC]
    >RewriteRule ^(.*) http://storedomain.com/static/%1.html? [R,L]
    >RewriteCond ${tolower:%{QUERY_STRING}} Product_Code=3D(.*)$ [NC]
    >RewriteRule ^(.*) http://storedomain.com/static/%1.html? [R,L]
    >
    >
    > ----- Original Message -----=20
    > From: Amanda P. - Miva List=20
    > To: Kelly XR ; [email protected]=20
    > Sent: Wednesday, May 18, 2005 6:11 PM
    > Subject: Re: [mru] mod rewrite question for static urls
    >
    >
    > Okay, I've done some googling on "tolower" and see it being used =
    with a "rewritemap" command... I'm not going to give up. :o)
    >
    > Amanda
    >
    > ----- Original Message -----=20
    > From: Amanda P. - Miva List=20
    > To: [email protected]=20
    > Sent: Wednesday, May 18, 2005 5:56 PM
    > Subject: Fw: [mru] mod rewrite question for static urls
    >
    >
    > I don't have a host - I have a dedicated server, and I am =
    using it in the httpd.conf file. =20
    >
    > Amanda
    >
    >
    > ----- Original Message -----=20
    > From: Kelly XR=20
    > To: Kelly XR=20
    > Cc: Amanda P. - Miva List ; [email protected]=20
    > Sent: Wednesday, May 18, 2005 5:07 PM
    > Subject: Re: [mru] mod rewrite question for static urls
    >
    >
    > I found out this will only work in httpd.conf not in the =
    .htaccess file...
    > So it will depend on how your host has your serving set up if =
    you can=20
    > have access to do it in your httpd.conf file or not.
    > the httpd.conf affects a lot more than just your html =
    directories...so=20
    > if you are on a shared server, your host will probably not =
    allow this.
    >
    > Kelly
    >
    >
    > Kelly XR wrote:
    >
    > > oops my syntax error... try it just like the original =
    rewriteCond
    > > but put the tolower: in front...
    > > like this...
    > > RewriteCond %{tolower:QUERY_STRING} Category_Code=3D(.*)& =
    [NC]
    > > That is what I meant to type
    > > Kelly
    > >
    > >
    > > Kelly XR wrote:
    > >
    > >> THere is something called tolower...
    > >>
    > >> I'm not sure if you need to redirect to map of somewort.. =
    or if it=20
    > >> will work...
    > >> but you might try it like this...I haven't tried it yet =
    myself...
    > >>
    > >> RewriteCond ${lowercase:%{QUERY_STRING}}
    > >>
    > >> But if it works! LET US KNOW!!!
    > >>
    > >> Kelly
    > >>
    > >>
    > >>
    > >> Amanda P. - Miva List wrote:
    > >>
    > >>> I have Merchant Optimizer, and I'm trying to set up the =
    mod rewrite=20
    > >>> rules so the merchant.mvc? product and category screen =
    URLS rewrite=20
    > >>> to the MO pages. I am having problems because some =
    product codes=20
    > >>> and categories have capital letters in them. When the =
    URLs are=20
    > >>> rewritten, it keeps the caps in tact, but all of the MO =
    pages are=20
    > >>> built with lowercase URLs.
    > >>>
    > >>> I tried the suggested rules that come with MO docs:
    > >>>
    > >>> RewriteEngine On
    > >>> RewriteCond %{QUERY_STRING} Category_Code=3D(.*)& [NC]
    > >>> RewriteRule ^(.*) http://storedomain.com/static/%1.html =
    [R,L]
    > >>> RewriteCond %{QUERY_STRING} Category_Code=3D(.*)$ [NC]
    > >>> RewriteRule ^(.*) http://storedomain.com/static/%1.html =
    [R,L]
    > >>> RewriteEngine On
    > >>> RewriteCond %{QUERY_STRING} Product_Code=3D(.*)& [NC]
    > >>> RewriteRule ^(.*) http://storedomain.com/static/%1.html =
    [R,L]
    > >>> RewriteCond %{QUERY_STRING} Product_Code=3D(.*)$ [NC]
    > >>> RewriteRule ^(.*) http://storedomain.com/static/%1.html =
    [R,L]
    > >>>
    > >>> This rewrote my URLs like this: =20
    > >>> =
    http://storedomain.com/static/produc...&Product_Code=
    =3Dproductcode =20
    > >>> I have my Merchant2 files in my root directory, so maybe =
    that's=20
    > >>> why. I finally fixed that problem by adding a ? to my =
    rules like so:
    > >>>
    > >>> RewriteEngine On
    > >>> RewriteCond %{QUERY_STRING} Category_Code=3D(.*)& [NC]
    > >>> RewriteRule ^(.*) http://storedomain.com/static/%1.html? =
    [R,L]
    > >>> RewriteCond %{QUERY_STRING} Category_Code=3D(.*)$ [NC]
    > >>> RewriteRule ^(.*) http://storedomain.com/static/%1.html? =
    [R,L]
    > >>> RewriteEngine On
    > >>> RewriteCond %{QUERY_STRING} Product_Code=3D(.*)& [NC]
    > >>> RewriteRule ^(.*) http://storedomain.com/static/%1.html? =
    [R,L]
    > >>> RewriteCond %{QUERY_STRING} Product_Code=3D(.*)$ [NC]
    > >>> RewriteRule ^(.*) http://storedomain.com/static/%1.html? =
    [R,L]
    > >>>
    > >>> Now this rewrites my URLs correctly except for the case =
    issue I=20
    > >>> mentioned above:
    > >>> =
    http://storedomain.com/merchant.mvc?...ory_Code=3Dabc
    > >>> is rewritten to:
    > >>> http://storedomain.com/static/abc.html
    > >>>
    > >>> However,
    > >>> =
    http://storedomain.com/merchant.mvc?...ory_Code=3DABC
    > >>> is rewritten to http://storedomain.com/static/ABC.html
    > >>> which does not exist since MO converts it all to =
    lowercase:
    > >>> http://storedomain.com/static/abc.html
    > >>>
    > >>> Can anyone suggest the proper syntax to rewrite the URLs =
    to=20
    > >>> lowercase only? I've been looking at a million rewrite =
    examples,=20
    > >>> and haven't found anything that works yet. Thanks,
    > >>> Amanda
    > >>>

    ------=_NextPart_000_00DD_01C55C89.AEB8F8C0--
Working...
X