从 ubuntu 中 laravel 的 url 中删除 index.php

Kis*_*iya 1 ubuntu mod-rewrite url-rewriting laravel

我尝试了几种方法来从我的 URL 中删除 index.php。

像这样的问题

网址不起作用(我想要这个):http : //mysite.in/our-story

网址工作(我不想要这个):http : //mysite.in/index.php/our-story

1) 我试图启用 rewrite_mod 但它已经启用。

2) 我曾尝试将此代码写入 .htaccess 文件,但问题未解决。

选项 -MultiViews RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L] </IfModule>
Run Code Online (Sandbox Code Playgroud)

任何文件安装剩余?然后告诉我??(但我已经安装了所有东西。)

我的 000-default 文件是:

    ServerAdmin webmaster@localhost

    ServerName mydomain.in

    DocumentRoot /var/www/mysite/public
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/mysite/public/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow  Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
Run Code Online (Sandbox Code Playgroud)

请给我解决方案。

谢谢朋友!!!

Kis*_*iya 5

将 AllowOverride 更改为 all 而不是 none。

通过杰森刘易斯