[ic] Getting rid of /cgi-bin/scriptname

Frederic Steinfels interchange-users@icdevgroup.org
Sat Mar 15 06:20:01 2003


For those who are interested in removing /cgi-bin/catalogname from the url string, this is the solution:

In your apache configuration file, insert the following lines for your virtualsever and secure virtualserver:


RewriteEngine   on

RewriteRule     ^$      /cgi-bin/shop/  [L,NS,PT]
RewriteRule     ^/$      /cgi-bin/shop/  [L,NS,PT]
RewriteRule     ^/index\.html$      /cgi-bin/shop/  [L,NS,PT]

RewriteCond     /home/shop/www/html/%{REQUEST_FILENAME} -f      [OR]
RewriteCond     /home/shop/www/html/%{REQUEST_FILENAME} -d
RewriteRule     ^(.+)$  -  [L,NS]

RewriteCond     /%{REQUEST_FILENAME}    !^.*/cgi-bin/shop.*$
RewriteRule     ^(.+)$  /cgi-bin/shop/$1  [L,NS,PT]



Replace 'cgi-bin' with your cgi-bin directory, probably no substitution necessary.
Replace 'shop' with your catalog name.
Raplece '/home/shop/www/html' with your html directory.

Make sure you do not have conflicting file names or directory names in your catalog and your html directory.
This patch might break other web pages or scripts on your server; some fine tuning might be necessary.
It should work staight away if you are running just interchange with only one catalog.

After doing this, try to access your interchange pages by omitting 'cgi-bin/catalogname/'. If it works, do this:
Edit in your catalog directory the file products/variable.txt. Search for the line 'CGIURL'. Delete the string,
'/cgi-bin/catalogname'. Do not remove any tabulators.
Restart Interchange.
Open a new browser, make sure you will get a new session id and check wheter all links are ok.

Frederic