Laravel project next to Wordpress project (in public_html folder)

zyzer01

Newbie
Joined
Apr 28, 2023
Messages
27
Reaction score
9
I have a Laravel project in my public_html folder, on Cpanel. The domain is for example domain.com
So an example of a URL is http://domain.com/appointment.

Now I would like to have a wordpress website on domain.com. So when you go to domain.com you see the wordpress website. But I also want to have the urls like /appointment of my laravel project.

What's the easiest and cleanest way to do this?
 
Hi,
How about you create a subdomain for your Laravel project and assign the subdomain's public_html directory inside the public_html of the main domain?
For example; "laravel.domain.com/public_html", OR "laravel.domain.com" should be in the main domain's root directory like: public_html/laravel.domain.com OR public_html/laravel depending on the cPanel.
This will make the Laravel project accessible as a subdomain; http://laravel.domain.com, OR as a path; http://domain.com/laravel

Hope this helps :)
 
Hi,
How about you create a subdomain for your Laravel project and assign the subdomain's public_html directory inside the public_html of the main domain?
For example; "laravel.domain.com/public_html", OR "laravel.domain.com" should be in the main domain's root directory like: public_html/laravel.domain.com OR public_html/laravel depending on the cPanel.
This will make the Laravel project accessible as a subdomain; http://laravel.domain.com, OR as a path; http://domain.com/laravel

Hope this helps :)
Hi.
Thanks for your suggestions
But I would rather like it to be on the main domain name.
 
The cleanest way is to use reverse proxy, e.g. nginx. So, you would configure a virtual host, and match /appointment/* folder to your laravel web path. The default path for that host would be the wp installation. But this is easier said than done.
 
The cleanest way is to use reverse proxy, e.g. nginx. So, you would configure a virtual host, and match /appointment/* folder to your laravel web path. The default path for that host would be the wp installation. But this is easier said than done.
Can you share any resource that can be of help?
 
Can you share any resource that can be of help?
Depends on your setup. For sites running on apache it should be something like this:

Code:
https://learnwithdaniel.com/2021/03/run-laravel-project-in-subfolder-apache/

For nginx try something like this:
Code:
https://gist.github.com/tsolar/8d45ed05bcff8eb75404
 
Depends on your setup. For sites running on apache it should be something like this:

Code:
https://learnwithdaniel.com/2021/03/run-laravel-project-in-subfolder-apache/

For nginx try something like this:
Code:
https://gist.github.com/tsolar/8d45ed05bcff8eb75404
Thanks man
 
Back
Top