Silex"你好世界" - 404

时间:2015-03-12 22:41:52

标签: php apache .htaccess redirect silex

我在fedora 21上安装了LAMP,安装了silex,创建了一个虚拟主机。这是配置:

<VirtualHost *:80>
ServerName film.dev
DocumentRoot /var/www/html/video/web/
</VirtualHost>

在/ web目录中,我用内容创建.htaccess:

<IfModule mod_rewrite.c>
Options-MultiViews

RewriteEngine On
RewriteBase /video/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

在页面http://film.dev/hello上,我得到了404.

在web / index.php文件中,我改变了: &#34; $ app-&gt; get(&#39; / hello&#39;,&#34; to&#34; $ app-&gt; get(&#39; /&#39;,&#34; ; 它的工作。

告诉我,如何通过重定向解决问题?

2 个答案:

答案 0 :(得分:0)

替换

<IfModule mod_rewrite.c>
    Options-MultiViews

    RewriteEngine On
    RewriteBase /video/web
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

使用

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /video/web
    RewriteCond $1 !^(index\.php|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

希望它对你有用。

答案 1 :(得分:0)

尝试修改下面的vhost配置信息。

<VirtualHost *:80>
ServerName film.dev
DocumentRoot /var/www/html/video/web
<Directory "/var/www/html/video/web">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All 
    Order deny,allow
    Allow from all 
</Directory>

希望这可以帮到你!

相关问题