Author: Srikanth Bangalore
Date: Monday, January 12, 2009.
Notes On Getting Rid Of Cgi-Bin/Your-Shopping-Cart/ From Your URLs For Your Interchange Based Shopping Cart Site
.......................................................................
Suppose your URL for the shopping cart is:
http://www.your-website.com/cgi-bin/your-shopping-cart/index.html
Everything is great, except that every single URL contains cgi-bin/your-shopping-cart.
Here is an easy way of getting rid of cgi-bin/your-shopping-cart from every URL.
STEP 1: Edit your .htaccess file. Add all the lines from SAMPLE HTACCESS FILE below (after suitably editing them) to the very top of the .htaccess file.
a. Where is .htaccess located?
It is located in the public_html folder. You can access it by FTP.
b. What does .htaccess do?
Its main job is to tell your HTTP Server (mostly Apache) how to deal with URLs that begin with http://www.your-website.com . If you leave it empty, then Apache simply interprets http://www.your-website.com/a/b/c.html as displaying the file "c.html" from the folder ~/public_html/a/b/
STEP 2: Edit your your-shopping-cart/products/variable.txt file. Replace all instances of cgi-bin/your-shopping-cart/ with /
STEP 3: Restart Interchange
........................................................................
BEGIN SAMPLE HTACCESS FILE
RewriteEngine on
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^your-website.com$
RewriteRule ^/?(.*)$ "https\:\/\/www\.your-website\.com\/$1" [R=301,L]
RewriteCond %{HTTP_HOST} ^your-website.com$
RewriteRule ^/?(.*)$ "http\:\/\/www\.your-website\.com\/$1" [R=301,L]
http://www.your-website.com/cgi-bin/your-shopping-cart/index.html [L]
http://www.your-website.com/cgi-bin/your-shopping-cart/index.html [R]
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^www.your-website.com$
RewriteCond %{REQUEST_URI} !^\/cgi-bin\/your-shopping-cart
RewriteCond %{REQUEST_URI} !^.*503.shtml.*$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ https://www.your-website.com/cgi-bin/your-shopping-cart/$1 [L]
RewriteCond %{SERVER_PORT} ^443$
RewriteCond %{HTTP_HOST} ^www.your-website.com$
RewriteCond %{REQUEST_URI} ^\/$
RewriteRule ^(/)*$ https://www.your-website.com/cgi-bin/your-shopping-cart/$1 [L]
RewriteCond %{HTTP_HOST} ^www.your-website.com$
RewriteCond %{REQUEST_URI} !^\/cgi-bin\/your-shopping-cart
RewriteCond %{REQUEST_URI} !^.*503.shtml.*$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://www.your-website.com/cgi-bin/your-shopping-cart/$1 [L]
RewriteCond %{HTTP_HOST} ^www.your-website.com$
RewriteCond %{REQUEST_URI} ^\/$
RewriteRule ^(/)*$ http://www.your-website.com/cgi-bin/your-shopping-cart/$1 [L]
END SAMPLE HTACCESS FILE
.......................................................................
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment