zoukankan      html  css  js  c++  java
  • Laravel 404错误,Laravel根目录可以访问,非根目录就会出现404 页面找不到的错误

    Laravel根目录可以访问 Route::get(‘/‘, ‘HomeController@showWelcome‘);

    非根目录就会出现404 页面找不到的错误,如下

    Route::get(‘user‘, ‘UserController@index‘);

    解决方法:
    首先安装前

    1,php开启phpopenssl

    2,在apache conf开启rewrite莫块
    模块(#LoadModule rewrite_module modules/mod_rewrite.so)

    3,在conf文件中找到directory 把AllowOverride None 改成 AllowOverride All

    <Directory "c:/Apache24/htdocs">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    4,在laravel项目工程的public目录下添加.htaccess文件 ,文件内容如下

    <IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    </IfModule>

    *************************************************************************************************************

    本人安装时解决方法其它不动

    ;extension=php_openssl.dll
    只需要将php.ini中上面的代码前;去掉即可

    **********************************************************************************************************

  • 相关阅读:
    07spring-mybatis整合
    08ssm三大框架整合
    05spring_AOP
    06spring-test
    03spring初始化销毁自动装配
    04spring注解
    01spring简介入门
    02spring_IoC
    09springmvc_mybatis框架整合
    简单的搭建一个SSH框架
  • 原文地址:https://www.cnblogs.com/zhang-bin/p/7736063.html
Copyright © 2011-2022 走看看