[ic] removing .../cgi-bin/catname/... from URLs

Frank Reitzenstein frank at goldissue.com
Thu Dec 14 01:39:25 EST 2006


Jon Jensen wrote:

> On Wed, 13 Dec 2006, Peter wrote:
>
>>> I've verified that Catalog definition indeed has the format:
>>>
>>> Catalog  mycat  /home/someuser/catalogs/mycat  /cgi-bin/mycat  /
>>>
>>> yet IC is still including the .../cgi-bin/mycat/... in the URLs. I
>>> restarted IC just for kicks yet still no luck. Can you suggest a way to
>>> troubleshoot?
>>>
>>> I've noticed that the misbehaving store has a CGI_URL defined in the
>>> Prefernces tab of the Admin GUI, but the behaving store does not. Could
>>> this be the cause?
>>
>>
>> Indirectly, yes.  Look for VendURL and SecureURL in catalog.cfg.
>
>
> DB,
>
> I need to explain my earlier reply better. What Peter says about
> VendURL is in general correct. However, when you have any URL prefix
> aliases defined for the catalog, if a request comes in through one of
> them, that will override VendURL for all future URLs written by [area]
> etc. The manual explains this:
>
> http://www.icdevgroup.org/docs/confs/Catalog.html
>
> So my example only makes sense if taken in the context of an Apache
> setup for making pretty catalog URLs, such as this:
>
>     ScriptAlias /cgi-bin/ /path/to/your/cgi-bin/dir/
>     RewriteEngine on
>     RewriteRule ^/store/(.*) /cgi-bin/standard/$1 [PT,L]
>
> Then you'd set up interchange.cfg like this:
>
>     Catalog  standard  /path/to/catalogs/standard  /cgi-bin/standard 
> /store
>
> Thus, users would go to this URL to enter the site:
>
>     http://your.domain/store/
>
> But Interchange would see you coming in through:
>
>     http://your.domain/cgi-bin/standard/
>
> because of the Apache RewriteRule.
>
> The first URL prefix is considered the "main" one, not an alias, and
> does not take over URL generation as an alias does, so the Catalog
> definition above doesn't lead to aliases URL generation; it just stays
> normal.
>
> But in the end it turns out that the /store alias I showed in my
> example isn't even necessary; Interchange never uses it or needs it to
> find the catalog, because it's seeing /cgi-bin/standard as the path
> prefix after URL rewriting.
>
> So, to sum up, I think your problem may be fixed with this Catalog
> directive:
>
>     Catalog  mycat  /home/someuser/catalogs/mycat  /
>
> assuming you have in Apache something like:
>
>     RewriteRule ^/(.*) /cgi-bin/mycat/$1 [PT,L]
>
> Though to take over the whole URL space like that, you'd need to have
> some previous RewriteRules that would make exceptions to statically
> serve images, CSS, JavaScript, robots.txt, favicon.ico, etc. directly
> from Apache, not passing them to Interchange.
>
> You'll get a lot more wasted requests passed through to Interchange by
> hostile bots, etc., which wouldn't be if you use a prefix like /store/
> or /ic/ or /app/ or something like that. You can still make the home
> page use the root URL http://your.domain/ with another RewriteRule like:
>
>     RewriteRule ^/(index.html?)?$ /cgi-bin/standard/index [PT,L]
>
> HTH,
> Jon
>
Hello Peter,

Below is an apache virtual host which does what you are seeking.

To get a seamless catalog at "/" all we would need to do is change
products/variable.txt as follows:

CGI_URL    /shop/example (ie /cgi-bin/example)

to

CGI_URL    /


Unfortunately we can't. We still need to check out at
https://www.goldissue.com

I tried using ports 444, 445, 446 for additional secure servers, but it
worked most of the time, then people would ring in and say that they
couldn't check out. Our server is on a very fast adsl connection, but
the isp is too inflexibble to supply the class C subnets we would like.

In other words urls like https://www.theyoungjerk.com:444 caused us some
grief. So what happens instead is that the visitor arrives at
http://www.example.com ok, but when he clicks home on the nav bar he
goes to www.example.com/shop/example

Here is a live example. You will need to replace /shop/example with
/cgi-bin/example:

                 <VirtualHost *:80>
                 DocumentRoot "/var/www/html/example"
                 ServerName www.example.com

SSLProxyEngine on
RewriteEngine on

RewriteRule ^\/Brahmi\/$  "http://www.example.com/PW-012.html" [P,L]
RewriteRule ^\/Acne\/$  "http://www.example.com/ET-036.html" [P,L]
RewriteRule ^\/Ginkgo\/$  "http://www.example.com/NA-010" [P,L]
RewriteRule ^\/Tryptophan\/$  "http://www.example.com/MM-001" [P,L]
RewriteRule ^\/Cod-Liver-Oil\/$  "http://www.example.com/TL-168" [P,L]
RewriteRule ^\/Tea-Tree-Oil\/$  "http://www.example.com/DE-007" [P,L]

RewriteRule ^\/Health\sConcerns\/(.*)$ 
"http://www.example.com/Health_Concerns/$1" [L]

RewriteRule ^\/Health_Concerns\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=5/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/Weight\sLoss\/(.*)$ 
"http://www.example.com/Weight_Loss/$1" [L]


RewriteRule ^\/Weight_Loss\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=13/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/Amino\sAcids\/(.*)$ 
"http://www.example.com/Amino_Acids/$1" [L]

RewriteRule ^\/Amino_Acids\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=1/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/Fitness\sAccessories\/(.*)$ 
"http://www.example.com/Fitness_Accessories/$1" [L]

RewriteRule ^\/Fitness_Accessories\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=4/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/Shakes\s&\sDrinks\/(.*)$ 
"http://www.example.com/Shakes_&_Drinks/$1" [L]

RewriteRule ^\/Shakes_&_Drinks\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=10/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/Herbs\s&\sAlternative\sBlends\/(.*)$ 
"http://www.example.com/Herbs_&_Alternative_Blends/$1" [L]

RewriteRule ^\/Herbs_&_Alternative_Blends\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=7/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/EFAs\sand\sDietary\sOils\/(.*)$ 
"http://www.example.com/EFAs_and_Dietary_Oils/$1" [L]

RewriteRule ^\/EFAs_and_Dietary_Oils\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=3/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/Sports\sNutrition\/(.*)$ 
"http://www.example.com/Sports_Nutrition/$1" [L]

RewriteRule ^\/Sports_Nutrition\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=11/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/Vitamins\s&\sMinerals\/(.*)$ 
"http://www.example.com/Vitamins_&_Minerals/$1" [L]

RewriteRule ^\/Vitamins_&_Minerals\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=12/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/Protein\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=9/va=banner_image=/va=banner_text=.html"
[P,L]


RewriteRule ^\/Creatine\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=2/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/Nutrition\sBars\/(.*)$ 
"http://www.example.com/Nutrition_Bars/$1" [L]

RewriteRule ^\/Nutrition_Bars\/$ 
"http://www.example.com/shop/example/scan/st=db/fi=cat/sp=imagecat/co=yes/sf=sel/ml=100/se=8/va=banner_image=/va=banner_text=.html"
[P,L]

RewriteRule ^\/([A-Z].*)\/(.*)\s(.*)\s(.*)\s(.*)\/$ 
"http://www.example.com/$1/$2_$3_$4_$5/" [L]
RewriteRule ^\/[A-Z].*\/([A-Z].*)_(.*)_(.*)_(.*)\/ 
"http://www.example.com/scan/st=db/fi=products/ml=100/sp=results/co=yes/sf=cat/se=$1
$2 $3 $4/va=banner_image=/va=banner_text=.html" [P,L]



RewriteRule ^\/([A-Z].*)\/(.*)\s(.*)\s(.*)\/$ 
"http://www.example.com/$1/$2_$3_$4/" [L]
RewriteRule ^\/[A-Z].*\/([A-Z].*)_(.*)_(.*)\/ 
"http://www.example.com/scan/st=db/fi=products/ml=100/sp=results/co=yes/sf=cat/se=$1
$2 $3/va=banner_image=/va=banner_text=.html" [P,L]


RewriteRule ^\/([A-Z].*)\/(.*)\s(.*)\/$ 
"http://www.example.com/$1/$2_$3/" [L]
RewriteRule ^\/[A-Z].*\/([A-Z].*)_(.*)\/ 
"http://www.example.com/scan/st=db/fi=products/ml=100/sp=results/co=yes/sf=cat/se=$1
$2/va=banner_image=/va=banner_text=.html" [P,L]

RewriteRule ^\/[A-Z].*\/([A-Z].*)\/ 
"http://www.example.com/scan/st=db/fi=products/ml=100/sp=results/co=yes/sf=cat/se=$1/va=banner_image=/va=banner_text=.html"
[P,L]

########################################################
RewriteRule ^$  /shop/example/index.html          [PT,L]
RewriteRule ^/$ /shop/example/index.html          [PT,L]
RewriteRule ^/index\.html$ /shop/example/index.htm [PT,L]
RewriteRule ^/shop/example/.* -                   [PT,L]
RewriteRule ^/.*images/.* -                            [PT,L]
RewriteRule ^/(.*) /shop/example/$1               [PT,L]

RewriteRule ^/admin$  /shop/example/admin/index.html          [PT,L]
RewriteRule ^/admin/$ /shop/example/admin/index.html          [PT,L]
RewriteRule ^/admin/index\.html$ /shop/example/admin/index.htm [PT,L]
RewriteRule ^/shop/example/admin/.* -                   [PT,L]
RewriteRule ^/admin/(.*) /shop/example/admin/$1               [PT,L]
         CustomLog /etc/httpd/logs/www.example.com/access_log
combined               
Redirect permanent /shop/example/arginine.html
"http://www.example.com/l_arginine_powder"
Redirect permanent /shop/example/arginine
"http://www.example.com/l_arginine_powder"


              </VirtualHost>

Regards,

Frank.


More information about the interchange-users mailing list