how to use laravel on main page - from a subfolder - php

I decide to use Laravel on my existing blog - let's say - example.com
All of my files and folders are inside public_html folder
I installed Laravel using Softaculous on cPanel
Firstly I tried to install it inside public_html - but get a warning - index.php already exists
So I choose public_html/lar/ as destination
and now - how can I use the framework on my site ?
for example on my home page (index.php) I have an ajax call to index.pro.php
let's say - index.pro.php need to send an email
how can I use Laravel engine for that task ?
it is installed completelly on a differrent folder - i.e. subfolder - public_html/lar/ ?

You need to edit your .htaccess file on cPanel
DirectoryIndex public_html/lar/public/index.php

Related

use subdirectory as other purpose in laravel

I have installed laravel in my root of domain, its working fine. However
I want use one sub directory for other purpose like install admin panel in it. For example I have installed laravel in example.com Now I want install other core PHP admin panel in new sub directory called adminpanel. its like this example.com/adminpanel/
but when I try to access it, its giving me error called page does not redirect correctly. I have read somewhere that I can achieve it if I modify my .httaccess file but I have not much knowlede of it. Let me know if someone can help me for same.
Thanks!
Better option is creating an subdomain for the admin dashboard. Login into your cPanel and create a sub domain adminpanel.example.com set the path to your new folder.
Non cPanal
If you don't have cPanel, You should create vhosts for your subdomain in server config (apache/nginx).

CakePHP 3 Serve Files From Plugin Webroot

I am under the impression that any files placed in the webroot/ folder of a plugin in CakePHP 3 should be served automagically. However, I have not been able to get a file to be served from that folder...
I have created an example project
https://github.com/CakePHPKitchen/CakePHP-Plugin-Webroot-Issue
In the example project, I have baked a plugin named Elite and inside the plugins/Elite/src/webroot I have placed a text file named bingo.txt
To reproduce the issue
Clone the repository above
Execute the command bin/cake server -p 8675
Visit http://localhost:8675/bingo.txt
View Missing Bingo Controller Error
My Question is, how do I retrieve bingo.txt?
Do I have to set a setting somewhere to enable that webroot folder?
Make sure the plugin is loaded in your config/bootstrap.php
Plugin::load('Elite');
Then link to the webroot of the plugin with localhost:8675/elite/bingo.txt

How to run a directory located inside a laravel project

I want to run a directory/folder located on the root of server same place where other laravel file are located. but when I put url like www.example.com/mobile/functions.php its not working, in return laravel's route not found message received.
My Directory Structure is
-\Root
- app
- config
- database
- mobile
> - db.php
> - index.php
> - +functions.php
- *public
- resources
- route
- storage
- tests
- vendor
I want to run that mobile folder as www.example.com/mobile.
Anyone Help me
Thanks
place it in public folder or same folder with your index.php

how to install laravel inside an addon domain

I have an addon domain like this :
/public_html/mysite
Site is available from the following address:
www.mysite.com
now I want to install laravel on this addon site.
I've copied all folders insdie mysite directory :
but when I enter www.mysite.com on my browser it shows content of my laravel project :
solved:
How to install laravel inside an addon domain
There are different ways you can install laravel inside an addon domain. Here is one of the easiest ways to do it.
Go to your CPanel and open Softaculous Apps Installer.
Look for Laravel Installer and open it. Carefully select the addon domain where you want to install Laravel.
Click Install. If there was no previous install then it would take 3-4 seconds.
Now go to the File Manager and open that specific domain folder. You will see All the laravel files there.
Now if you have an existing project that you want to upload on this domain simply make a zip file of your project and upload & extract inside this domain folder.
ONE LAST THING
When you install Laravel using Softaculous Apps Installer you get a redirect from domain to /public. To resolve this open index.php file (Not the one inside the public folder, one that is outside). Remove all the code from it and just paste the code given below.
<?php
header('Location: public/');
?>
And that is it. This should work for you.
Is it a shared hosting you're using if yes then :
Put the content of public (L5) directly on public_html (be aware of don't overwrite the .htaccess file accidentally)
Now in
then modify your index.php and your bootstrap.php and it will work just fine

Install laravel in a subfolder via ftp

I'm working with a server that I can only use FTP, so I have my laravel project in a folder inside www named 'laravel', I want to see my project by clicking domain.com/laravel, inside this www folder I have others folders with others projects I don't think that I can use the root to upload my laravel project like I saw in many tutorials.
Now If I visit domain.com/laravel i only see a list of directories ,Is possible to view my project working at /laravel ??
Thanks!
You would either need to add a custom mod rewrite config or configure your apache virtual host directory to be laravel/public

Categories