Krayin CRM
Read Story

How to redirect your laravel e-commerce project from the /public folder to the main domain?

After you are done setting up your laravel e-commerce project, major roadblock comes in redirecting the laravel e-commerce project from /public folder to the main domain so as to make it easily accessible to the general public and become SEO friendly.

Redirect Laravel e-commerce project from the /public folder to the main domain

You can follow the below steps to successfully redirect your laravel e-commerce project from /public folder to the main domain.

Hostings having Root Access

Below we have mentioned steps that can be followed for those who are either using dedicated hosting or VPS in which they have permission for root access so as to make the changes.

Step 1

Once you have successfully installed Bagisto, it will appear something like this. Below I am giving the example in which I have installed Bagisto on my local directory.

Step 2

If you are using Apache server, you need to go into your system files at the following path:

You will get a configuration file named as 000-default.conf (the file name can vary).

Step 3

Open the as said file above and add the following at the end of the document.

Change the following parameters as for your settings

After you have saved the configuration, just restart your Apache service again.

Step 4

Next, open the .env file which is there in your Bagisto directory and make the below changes.

APP_URL: You need to change the already existing path to the primary domain which you want to point.


Once the configuration has been done, the bagisto front-end will appear on the domain that has been provided by you.

For Shared Hostings

Below we have mentioned steps which you can follow if you are using shared hosting or something similar in which you don’t have the root access to do the changes.

Step 1

Find the .htaccess file inside the public_html(root directory of your primary domain). If the file is not there, you can create a new file from File Manager, named .htaccess.

Open the .htaccess file and add the following code

Save the file and clear your browser cache to look for the changes.

. . .

Comments (8)

Add Your Comment

  • Nhut
    How about set up sub domain for backend?
    • saurav pathak
      Hi Nhut,

      Greetings for the day!!!

      If you have installed bagisto on and redirect the public folder to point to the same, you can open the backend at

  • Nakib Imrul Hasan
    I’m using shared hosting and followed the step mentioned above but failed. Do I need anything else to edit? I’ve also tried change the .env file’s app url but nothing did happen.
    • saurav pathak
      Kindly put the document root till public in the apache config file and then restart apache. If you get any error send us the screenshot.
      • Farhan
        Dear Saurav,

        Let me know how can we access apache config file in shared hosting ?? “nakib imrul hasan” asked you aboubt shared hosting…. I am also facing same issue if you have any solution comment out….

        • saurav pathak
          Hi Farhan,

          For shared hosting I have mentioned: Find the .htaccess file inside the public_html(root directory of your primary domain) and then add code into that

  • TWilson
    how can I setup 301 redirects ?
    • saurav pathak
      Hi there,

      Please once put the query on our forum so the dev can see to it and assist you:

  • css.php