Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php .htaccess问题:RewriteBase接受一个参数,即每个目录上下文的基本URL_Php_.htaccess_Ubuntu_Laravel 4_Apache2 - Fatal编程技术网

Php .htaccess问题:RewriteBase接受一个参数,即每个目录上下文的基本URL

Php .htaccess问题:RewriteBase接受一个参数,即每个目录上下文的基本URL,php,.htaccess,ubuntu,laravel-4,apache2,Php,.htaccess,Ubuntu,Laravel 4,Apache2,我使用的是Laravel,在访问我的部分应用程序时,如果不在URL中添加index.php,就会出现问题。经过一些研究,我发现我需要: 激活“重写”模块 将AllowOverride设置为All 我已经做到了。然而,在做了所有这些之后,出现了一些新问题。首先,我无法访问public文件夹,出现以下错误(查看apache2/error.log): 这是.htaccess文件 <IfModule mod_rewrite.c> <IfModule mod_negotiatio

我使用的是Laravel,在访问我的部分应用程序时,如果不在URL中添加
index.php
,就会出现问题。经过一些研究,我发现我需要:

  • 激活“重写”模块
  • AllowOverride
    设置为
    All
  • 我已经做到了。然而,在做了所有这些之后,出现了一些新问题。首先,我无法访问
    public
    文件夹,出现以下错误(查看
    apache2/error.log
    ):

    这是
    .htaccess
    文件

    <IfModule mod_rewrite.c>
        <IfModule mod_negotiation.c>
            Options -MultiViews
        </IfModule>
    
        RewriteEngine ON
        RewriteBase /laravel/  # Redirect Trailing Slashes...
        RewriteRule ^(.*)/$ /$1 [L,R=301]
    
        # Handle Front Controller...
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.php [L]
    </IfModule>
    

    理想情况下,我希望用户能够在应用程序中导航,而无需添加index.php。

    尝试删除行中的注释

    RewriteBase /laravel/  # Redirect Trailing Slashes...
    
    其他一切看起来都很好


    netfreehost@FL

    尝试删除行中的注释

    RewriteBase /laravel/  # Redirect Trailing Slashes...
    
    其他一切看起来都很好


    netfreehost@FL

    尝试删除行中的注释

    RewriteBase /laravel/  # Redirect Trailing Slashes...
    
    其他一切看起来都很好


    netfreehost@FL

    尝试删除行中的注释

    RewriteBase /laravel/  # Redirect Trailing Slashes...
    
    其他一切看起来都很好


    netfreehost@FL

    谢谢。必须从行中删除注释!谢谢必须从行中删除注释!谢谢必须从行中删除注释!谢谢必须从行中删除注释!