XAMPP阿帕奇重写不工作 [英] xampp apache rewrite not working

查看:294
本文介绍了XAMPP阿帕奇重写不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为CRM在htdocs文件夹,其中包含一个新的laravel 5.1
项目,我试图通过 HTTP接取它://本地主机/ CRM /
但它只是带来了页面包含的目录内容的索引
而不是我的routes.php文件映射为

I have a folder called crm in htdocs which contains a fresh laravel 5.1 project and i am trying to acess it via http://localhost/crm/ but it just brings the index of page containing the directory contents instead of the page mapped in my routes.php as

Route::get('/', function () {
    return view('panel');
});

我已经检查了Apache的mod_rewrite是能够在httpd.conf

i have checked that apache mod_rewrite is enable in httpd.conf

LoadModule rewrite_module modules/mod_rewrite.so

DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">

    Options Indexes FollowSymLinks Includes ExecCGI

    AllowOverride All

    Require all granted
</Directory>

那么CRM /公用文件夹中的.htaccess文件包含

then the .htaccess file in crm/public folder contains

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

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

我也曾尝试将其更改为

I have also tried to change it to

Options +FollowSymLinks
RewriteEngine On

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

没有成功。

推荐答案

您需要指向Laravel到公共目录,使其工作。例如,如果你在安装在C Laravel:/ XAMPP / htdocs中/ 目录,则需要使用这些设置:

You need to point Laravel to public directory to make it work. For example, if you've installed Laravel in C:/xampp/htdocs/ directory, you need to use these settings:

DocumentRoot "C:/xampp/htdocs/public"
<Directory "C:/xampp/htdocs/public">

不要编辑 .htacces 公共文件夹内。尝试改变设置,并通过将本地主机先加载Laravel网站。

Do not edit .htacces inside public folder. Try to change settings and load Laravel website by going to localhost first.

当你编辑Apache的配置文件,您应该重新启动Web服务器。

When you've edited Apache config file, you should restart web server.

这篇关于XAMPP阿帕奇重写不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆