Note: I don't want the public files directly under public_html because I have other files that would be overwritten.
I've already changed these to lines in my index.php file.
require DIR.'/../../MyOtherDomain.com/vendor/autoload.php';
$app = require_once DIR.'/../../MyOtherDomain.com/bootstrap/app.php';
The question is how do i point the laravel project to use the index.php file under public_html/public?
Thanks in advance.
Add a .htaccess
file in your root directory and paste the following code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Save and reload your browser.
Since you're using shared hosting, you need to change the document root of the domain to public_html/public. Then you need to point index.php to your Laravel project (which must only be located outside the public_html folder) by editing the following code:
require DIR.'/../../MyOtherDomain.com/vendor/autoload.php';
$app = require_once DIR.'/../../MyOtherDomain.com/bootstrap/app.php';
Note- MyOtherDomain.com folder should contain the Laravel project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With