I currently have an established website running on Wordpress using nginx as the web server. The site is installed in a directory structure like so:
/srv/
www.example.com/
public/
index.php # this is Wordpress's index.php file
wp-content/
wp-admin/
wp-includes/
We now want to add additional functionality to the website which requires custom code. I want to install Laravel so that it's accessed with the /api/ directory, for example: www.example.com/api Laravel would take over. Now, before you say "why don't you just use a subdomain like api.example.com, we're currently doing this but running into same-origin policy issues with ajax.
If I install Laravel to /srv/www.example.com/public and rename the public folder included with Laravel to api/, I run into the issue of exposing the core of Laravel to the outside.
I'd try creating a "laravel" folder under www.example.com (ie not inside the public directory), and put everything but the public directory there. Then place index.php at public/api/index.php and change the paths in that file, from "../bootstrap/" to "../../laravel/bootstrap/". That way laravel would only trigger to /api/ calls, and the core is outside of the www-root.
EDIT: Probably need to change the public path in bootstrap/paths.php too.
Awesome, I'll give this a try tonight. Thanks.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community