Search code examples
.htaccessopencartopencart-3opencart-module

How to hide /upload path in the URL in opencart


Am new to opencart, my store URL should look like this http://somedomain.com/

But after installing opencart it is appending /upload to URL like this :

*) http://somedomain.com/upload

*) http://somedomain.com/upload/index.php?route=product/category&path=20_27

How to hide /upload in the URL. I have tried to hide in .htaccess file but no luck.


Solution

  • When you download OpenCart-3.x, typically you would only need the content of "Upload" folder, which you will take out of this folder and move to the root directory of your website. Navigating to the root of your website from a browser then, in case of a first time installation of OpenCart, will start the installation wizard and you may follow the official installation instructions from that point on (https://docs.opencart.com/installation/).

    If you have already installed OpenCart and would like to get rid of "Upload" in your URL then move the content of the Upload folder into the root directory of your website. After you have done that, you will also need to update the URL in the config.php files (there are two config.php files, one in this Upload folder and the other in Upload/admin/ folder). So in the config.php files, update the http and https URLs to reflect the changes you made. To do that, firstly open the config.php that was found in root directory of the Upload folder and look for these lines:

    // HTTP
    define('HTTP_SERVER', 'http://somedomain.com/upload');
    
    // HTTPS
    define('HTTPS_SERVER', 'https://somedomain.com/upload');
    

    Change these to:

    // HTTP
    define('HTTP_SERVER', 'http://somedomain.com/');
    
    // HTTPS
    define('HTTPS_SERVER', 'https://somedomain.com/');
    

    Repeate the same for the config.php in the admin forlder. But note that in the admin config.php, these lines will also have the /admin appended to end of the URL so make sure you don't delete that.

    Now reload your browser page and "Upload" will disappear from your domain and you should now see http://somedomain.com/ instead of http://somedomain.com/upload.