Updated 8 August 2024
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.
You can follow the below steps to successfully redirect your laravel e-commerce project from /public folder to the main domain.
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.
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.
If you are using Apache server, you need to go into your system files at the following path:
1 |
/etc/apache2/sites-enabled |
You will get a configuration file named as 000-default.conf (the file name can vary).
Open the as said file above and add the following at the end of the document.
1 2 3 4 5 6 7 8 |
<VirtualHost *:80> ServerName bagisto.test.com ServerAdmin webmaster@localhost DocumentRoot /home/rishabhyogi/www/html/bagisto2.1.2/public ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> |
Change the following parameters as for your settings
After you have saved the configuration, just restart your Apache service again.
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.
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.
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
1 2 3 4 |
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^(.*)$ public/$1 [L] </IfModule> |
Save the file and clear your browser cache to look for the changes.
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
Ex: test.domain.com/admin