]> Pointing Website Root To osCommerce Catalogue Directory | Web Developer Reference Blog

Pointing Website Root To osCommerce Catalogue Directory

This is a simple snippet and configuration change which you can use to point the root of your website to your installation directory, normally ‘catalog’. This would mean the URL in the address bar would become http://www.mydomain.com/index.php instead of http://www.mydomain.com/catalog/index.php. An amateur coder could easily modify this code for other web projects. Pointing website root to WordPress installation directory

  • BACKUP! I cannot stress enough the importance of this.
  • Change all references to catalog below to  the name of your OSC directory.
  • I recommend that you do not call your OSC directory catalog for security by obscurity purposes.
  • Create a new blank text file in notepad, or another program that doesn’t add formatting, and copy/paste the following code into the new file:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/catalog/
#RewriteCond %{REQUEST_URI} !^/catalogFolder/
 
#LEAVE AS IS
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#LEAVE AS IS
 
RewriteRule ^(.*)$ /catalog/$1
#RewriteRule ^(.*)$ /catalogFolder/$1
 
RewriteRule ^(/)?$ catalog/index.php [L]
#RewriteRule ^(/)?$ catalogFolder/index.php [L]
  • The lines beginning with # are comments to help if a necessary character is accidentally deleted.
  • Save the file as htaccess.txt and upload to your htdocs/public_html folder or equivalent using your favourite ftp client or your server administration panel.
  • Rename the file to .htaccess
  • Download includes/configure.php, create a copy for backup purposes and open in a text editor such as notepad.
  • Find (around line 8):
define('DIR_WS_HTTP_CATALOG','catalog/');
define('DIR_WS_HTTPS_CATALOG','catalog/');
  • Replace these 2 lines with:
define('DIR_WS_HTTP_CATALOG','/');
define('DIR_WS_HTTPS_CATALOG','/');
  • Upload the edited file.
  • Download includes/admin/configure.php, backup and edit in a text editor such as notepad.
  • Find (around line 7):
define('DIR_WS_ADMIN','/catalog/admin/');
  • And change to:
define('DIR_WS_ADMIN','/admin/');
  • Find (around line 9):
define('DIR_WS_CATALOG','/catalog/');
  • And change to:
define('DIR_WS_CATALOG','/');

And your done, good luck! If you have difficulty in implementing this please contact me as I can do this for a small fee in a matter of minutes.

Feel free to also use the contact page for any assistance with LAMP (Linux Apache MySQL & PHP) driven websites. I am also competent in HTML, (X)HTML, CSS and SEO.

Tags: .htaccess, Apache, LAMP, osCommerce, Script, Security

Leave a Reply