How to host Laravel application in a sufolder along with normal php application?

Multi tool use
Multi tool use


How to host Laravel application in a sufolder along with normal php application?



I have a laravel application and a normal application. I want the normal application to run when user opens example.com/ but when the user opens example.com/laravel_application/ I want the laravel application to run. How can I achieve this. I tried various methods like creating symlinks but I seem to be always redirected to root directory (example.com/) e.g. when I open example.com/laravel_application/login
I am open to using apache or nginx.


example.com/


example.com/laravel_application/


example.com/


example.com/laravel_application/login




3 Answers
3



It's easier to add a subdomain for Laravel app. Otherwise, you will have to create Laravel routes based on the example.com/laravel_app path.



There are two solutions:



Create .htaccess file on sub-folder where you put your laravel application.



and add the code in .htaccess file


RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]



You can add a index.php file containing the following code and put it under your root Laravel folder.



<?php
header('Location: public/');


<?php


header('Location: public/');



?>


?>





Thank you for response! But I do not want 'public' written in the URL. Also, momentarily I am redirected to login page and soon redirected to root directory.
– user3563059
Jul 2 at 7:39






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

1l3 VDK,O p,a08xBPQ1dEs
pmxJyLiI,03 2S HsjMOC,q H8KO IOXnDtu,FQCxWhIYF5l9AsrYaqdMA9pfs,hP s,0pZ Ke,80fWCQJ568t KOg2j48xQ

Popular posts from this blog

Rothschild family

Cinema of Italy