How can I upload my local Laravel web project to server? - php

I work on a website which i made from Laravel and now i need to push it to the server and go live. I'm new to Laravel hosting. Earlier I did coding by pure php and those days i just push the project to server and it works. My server is one.com and this is what i get when i copy my content and try to access the page.
please help me on this manner! thank you

Option 1: Use .htaccess
if it isn't already there, create an .htaccess file in the Laravel root directory. Create a .htaccess file your Laravel root directory if it does not exists already. (Normally it is under your public_html folder)
Edit the .htaccess file so that it contains the following code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>

Laravel has an Entry Point (which is the index.php File). This File lives inside the public folder. To go L-I-V-E with a Laravel Project, you have to set your Document Root to point to the public Directory.
Right now, you can only access your Site by navigating to: http://van.lesthi.com/public/
At the moment of this writing; accessing the URL above throws somewhat of an SQL Error, which you may want to fix first....

Related

Moving Laravel Project to a Sub Directory

I am a newbie to Laravel.
I want to upload Laravel project from local to shared hosting server.
Scenario is like below:
I have a site (abc.com).
I want to deploy Laravel project inside this site so that URL will be like abc.com/xyz
I have moved Laravel project files and folders inside xyz folder.
But site is not running.
What paths needs to change and in which files?
Please help.
It will run as abc.com/xyz/public
This can be done, but keep in mind that having the Laravel files in your web server root is not recommended.
How you can accomplish abc.com/xyz:
In folder xyz where laravel is installed you can add this in a .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
Again, this setup is not recommended, because the Laravel files should never be in or above your root.
A better way would probably be to install Laravel in the dir below the root and set xyz as your public directory. You would just have to change the paths in index.php to make sure it searches for the Laravel files below your web root.

Setup laravel in shared hosting

I'm trying to setup laravel (5.4.12) in shared hosting. Following this tutorial I had deleted my public_html and created soft-link for public_html to public folder of laravel project. I had successfully setup laravel (5.3.29) following the same tutorial for my previous project. But this time when I try to open base url it downloads index.php file of public directory of laravel folder. Can anyone help me out.
You can do it without deleting public_html folder.
for routing to public forlder just add these lines to .htaccess files
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
Normally PHP files are downloaded when the web server isn't configured to serve PHP files. Sounds like you need to talk to your hosting provider.
Finally found the solution. The issue was with PHP version. I had selected PHP version 7.1.0RC4,I changed it to 7.0.12 and the problem is gone.
Laravel 5 setup without artisan serve command
Rename the server.php in the your Laravel root folder to index.php
copy the .htaccess file from /public directory to your Laravel root
folder.

Laravel htaccess in root directory

I want to host my Laravel 4 project on free webhosting. To work, the hosting root dir must point to the "public" folder of my project where is taking place the .htaccess file. I did not succeed with finding free hosting which allows changing the root dir so I tried to place another .htaccess file in the main project dir which redirects to the public folder. Then the landing page opens but non of the routes in routes.php works. So my question is:
Is it possible to put the .htaccess file from "public" to the main dir and the application to work properly ?
Hope my question was clear.
Yes, you can do that from create a .htaccess file in your laravel root directory.and put below code in that file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
It should be redirected easily.
Another way to remove public folder
for more reference click here....

Deploy CakePHP application to webserver

I am having trouble deploying my CakePHP application onto a shared web server. Here's what I've done:
1) I zipped the application from my local machine: application.zip
2) I then uploaded the zip file on to my public_html on the server and extracted it
So now my application sits at www.mydomain.com/application which works fine, but once I move the contents of the application folder onto public_html (so that my application sits at www.mydomain.com) it doesn't load the application properly. It only loads SOME of the links of the home page and none of the styles.
So to sum it up.. the app works fine right after extracting to public_html/application/
But once I move the contents of the application folder to public_html it doesn't work.
How am I supposed to set up the folder structure so that my application sits at www.mydomain.com?
Any help would be greatly appreciated.
I just happened to try deploying a Cake app in the same way to a shared server using CPanel and had exactly the same problem. What I discovered is that somehow (I think when I extracted the zip to the public_html directory there was an empty .htaccess file that didn't want to be replaced) the .htaccess file in the root of the application was empty.
Just make sure the .htaccess file in the root of your application (i.e. in public_html) contains this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Worked fine for me and I'm all set now!
You could also try deleting cache files in app/tmp/cache
Not the folders but the files in the folders

How to route request to codeigniter project outside document root

I have the following shared hosting file structure using a codeigniter project:
myTLD.com/sites/mysite
mysite contains: application, system , index.php ... ( standard CI2 setup )
myTLD.com/public_html - contains : index.php
I have symlinked myTLD.com/public_html/index.php to myTLD.com/sites/mysite/index.php
Unfortunately I am getting:
Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php
I have set it up this way to avoid placing the actual site in the document root for security purposes . I don't want to change mysite/index.php because I want to keep the entire project in its mysite directory where it can easily be revised etc.
The application and mysite/ folder are set to 755 so I don't think this is a permission problem .
My myTLD.com/public_html/.htaccess folder directs all requests to index.php:
RewriteEngine On
RewriteRule ^(.*)$ index.php
Can someone advise me on an approach to sending requests through to the codeigniter index file without causing this error?
Thank you
You can try following way
1) Remove the symlink
2) Use this in htaccess at myTLD.com/public_html/.htaccess
RewriteEngine on
RewriteRule ^(.*)$ myTLD.com/sites/mysite/index.php?/$1 [L]
Use absolute system path if you are aware of it.

Categories