Exclude directory from laravel 4 routing - laravel

I have laravel4 installed at my webserver in the sub directory laravel4 of my web root. in this web root directory there is another directory called modx which serves a MODX cms. before I had laravel4 installed i could open www.mydomain/modx to get the frontend of the cms. Now it is controled by laravel and I get an error. Web server is an apache2.
Maybe an illustration is better:
webroot /var/www/
│
├--laravel4/ <-serve/process via laravel
├--modx/ <-do not process via laravel
So what do I need to configure the only the laravel4 sub-directory is affected by laravel? is it the .htaccess file?

The best practice and for security sake, you should put laravel folder somewhere else other than web root.
And add a symlink from laravel folder to your web root. For example, execute following in Terminal
ln -s /path/to/your/laravel-master/public /path/to/your/web_root/laravel

Related

Laravel 5.5 How to access website insted of /public folder

I have setup laravel 5.5 on my localhost and want to
access the project directly instead of /public directory.
My Current link is: http://localhost/my_laravel/public/
I Want to access as: http://localhost/my_laravel/
start a server using
php artisan serve
in cmd/console go to the project directory and run the above cmd.
it will run your app on http://localhost:8000

How to deploy Laravel 5.5 on shared hosting without composer

I am trying to deploy a Laravel project on shared hosting. I copied the Laravel folder in user's root directory (/home/shrpr) and copied the content of public directory in /home/shrpr/www folder. I modified the index.php in public folder to include "../Laravel" as explained in site. Since, composer is not allowed on this shared hosting, I also copied my local vendor and storage folder along with laravel folder. But I still keep on getting error 500. So, I added a test.php file in the laravel folder and included it in index.php file to test if path and all is correct as under:
require __DIR__.'/../laravel/test.php'; die;
This works fine as the content of test.php is getting displayed properly. So, it looks like some dependencies of vendor folder is missing. Is there a way of identifying and uploading complete dependencies of laravel and uploading it, that is without use of composer?
Try composer update before upload to shared hosting.
Change permissons of your index.php to 644.
Check your enviroment, maybe isn't works.
Wich version of php is running in your shared hosting? and wich is yor Laravel version, change php version to 7.0
Make sure you have PHP 5.5+ installed on the server. Move the index.php file from public to www and change the paths accordingly.
Another way to deploy laravel on shared hosting is to set up your domain as addon domain and then set root folder of the addon domain to the /public folder of the laravel project. eg. home/mili/laravelproject/public
I tried this with godaddy and it worked.

Install Laravel on dedicated server's subfolder

So I am having an issue with pushing a Laravel app to production on a dedicated server's subfolder.
Server is run on Apache.
Url I want to push my app would be subdomain.domain.com/project
The structure of my dedicated server is
.cpanel
...
-laravel
-app
-vendor
-...
-public_ftp
-public_html
-folder
-contents of laravels public directory
-ssl
I know that in order not to expose my hidden files I am required to install it in a root directory, but this is not an option because I will be having multiple projects running under subdomain.domain.com/project-1, subdomain.domain.com/project-2 and etc... and all will have a separate laravel installation.
I need a hand in order to achieve that, can anyone give me some advice?
Managed to do it myself, the problem was when i was creating a symlink, so instead i just moved contents of my public directory to public_html/project-1/ and changed index.php path to /../../laravel/
The thing was that I have done it originally but I didnt expect that permissions for storage need to be manually set, that solved my issue and laravel works.
ALWAYS CHECK ERROR LOGS :)
You can place your separate folders in your subdomain with no problem.
The important thing is that you need to point the browser to public/ folder under your laravel projects.
You can create a .htaccess file with the command below in root folder of each project and perform a redirect.
Place the following command in your .htaccess file:
RedirectMatch ^/$ /public/

How to run laravel 5.0 project on localhost without use php artisan serve

I have created a laravel 5.0 project with php artisan serve, now i need to know how to run laravel 5.0 project run without start php artisan serve, i have already browse lot of websites no one help me..
You need to change "server.php" to "index.php" then copy ".htaccess" from public to root directory.
See: https://stackoverflow.com/a/30053989/3948755
Laravel sever Folder is "public". There is an index.php so you can run you project from there.
Suppose if you using UbuntuOS then you have to create your local server in public directory. Suppose your folder name is laravel_test then go in that directory and run some thing like this
php -S localhost:8000 -t public
If you using windows then access public folder from URL.
localhost/laravel/public
Actually it's bad practise to access folder from URL but for local its good. You also can go with host entry. Just make sure that your target folder is "public" directory.
Normally you would have WAMP/XAMPP installed. You can access Laravel project like below
localhost/laravel/public
But this is not recommended. You should create Virtual host for example
laravel.local that pints to server-root/laravel/public.
this is how you create virtual host.
Or even better go for a Laravel Homestead .
How is your .htaccess file configured?
Try with localhost/laravel/public/index.php
Use http://localhost/projectName/public
It will be work. but in case if you have another Route and you can not access that Route and get the error like " Page Not Found " then please use the following command
sudo a2enmod rewrite
Now open the http://localhost/projectName/public/yourRoute
This is a little late but still applicable, what I like to do (using ubuntu 14.x+) is put my laravel project (let's say Project1) in my var directory, so it would be in /var/Project1, then symlink the public folder to somewhere in /var/www(+/html depending on apache version).
Symlink can be done something like this:
ln -s /var/Project1/public /var/www/html
This keeps your internal files off the grid so to speak, this is untested so if I've missed anything just comment and I will amend this post.
EDIT:
Obviously if your http root is /var/www/html you can put your project in /var/www/Project1
If you have access to xampp or wampp on your operating system you can more or less configure your virtual host like in the instruction below:
https://bestin-it.com/creating-virtualhost-on-your-local-computer-to-start-simple-index-php/
This instruction shows how to run it locally on your PC, but it works generally the same on any hosting portals. In most case in payed portals you have any web panels to configure your public folder that reference to /public folder in laravel folder's structure.

Index page is not coming / showing in laravel framework

I am using Ubuntu 14.04LTS. Here is what i have done till now:
I have installed composer using curl,
move this composer.phar file to usr/local/bin directory
Created project laravel in my root folder i.e. var/www/html
Change the permission of app/storage folder.
Created the file name as laravel.conf like 000-default.conf in etc/apache2/site-avaliable directory.
edit that laravel.conf file from terminal and save that file.
disable 000-default.conf file and enable laravel.conf file.
restarted the apache2 service.
Here is my problem: now i am trying to run it from my localhost but it does not show index.php page of my project laravel.
Any help to sort this, will be highly appreciated.
Laravel builds its own output based on your controllers, generally utilizing view files (blades) as templates. Unless you specifically tell it to in your controller, it will not return a static or dynamic index.php page. If this is your first Laravel project, I recommend reading up on how routing works at http://laravel.com/docs/5.0/routing .

Resources