laravel5.2 migrated to the new server except for "/" routes, other routes corresponding to the page display reported 404 error (Object not found!)

Source: Internet
Author: User
1. Server System: Linux system
2.WEB Environment: Lamp (linux+ Apache+mysql+php) [Linux version of XAMPP Software integration pack used]
(1). Not storage and Bootstrap/cache folder permissions issues.
(2). Projects made with laravel5.2 are available on the local side of the Window System (WAMP) to test other pages. Testing other pages in the Linux Server (LNMP) environment can also be displayed.

Reply content:

1. Server System: Linux system
2.WEB Environment: Lamp (linux+Apache+mysql+php) [Linux version of XAMPP Software integration pack used]
(1). Not storage and Bootstrap/cache folder permissions issues.
(2). Projects made with laravel5.2 are available on the local side of the Window System (WAMP) to test other pages. Testing other pages in the Linux Server (LNMP) environment can also be displayed.

1. Open/etc/httpd/conf/httpd.conf (using xampp:/opt/lampp/etc/httpd.conf).
2. Make sure that the directory that DocumentRoot points to is the public folder in Laravel. If not, change to the following:

DocumentRoot "/var/www/html/laravel/public/"
  
   
    
       Allowoverride All
  
   

Note: (/var/www/html is to store the Laravel directory.) The general Linux default is the/var/www/html directory, XAMPP is under the/opt/lampp/htdocs/directory. Use xampp above/var/www/html/laravel/public/change to/opt/lampp/htdocs/laravel/public/)

3. Determine the Laravel public directory under the. htaccess file with the following code (if not, add the following code):


  
   
   
    
     
    Options -MultiViews
   
    RewriteEngine On# Redirect Trailing Slashes...RewriteRule ^(.*)/$ /$1 [L,R=301]# Handle Front Controller...RewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^ index.php [L]
  
   

4. Restart the Apache server. sudo service httpd restart (using XAMPP:
First off:/opt/lampp/lampp stop and restart:/OPT/LAMPP/LAMPP start
Detailed reference: http://stackoverflow.com/questions/21458080/ the-requested-url-projectname-users-was-not-found-on-this-server-laravel/24354757#24354757

URL rewriting.

Should be a URL rewrite issue

Apache

The Laravel framework uses the public/.htaccess file to make the URL unnecessary to index.php. If your server is using Apache, make sure you have the Mod_rewrite module turned on.
If the. htaccess file included with Laravel is not available in Apache, try the following:

Options +FollowSymLinksRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-dRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^ index.php [L]

Nginx

If you are using Nginx, you can add the following settings to your site settings:

location / {    try_files $uri $uri/ /index.php?$query_string;}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.