2

Silex を使用していくつかのプロジェクトに取り組んでいますが、.htaccess ファイルを動作させることができるプロジェクトはありません。現在のディレクトリ構造はhttp://localhost/IIV/

Silexのフロントファイルはhttp://localhost/IIV/web/index.php

これは私が現在持っているものです:

    Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /IIV/

RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]

RewriteCond %{DOCUMENT_ROOT}/web/$1 -f
RewriteRule ^(.+?)/?$ /web/$1 [L]

RewriteCond %{DOCUMENT_ROOT}/web/$1 !-f
RewriteRule ^(.+?)/?$ /web/index.php [L]
RewriteRule ^(.+?)/?$ /web/index_dev.php [L]
4

1 に答える 1

5

RewriteBase が間違っています。これを試してください:

<IfModule mod_rewrite.c>
    Options -MultiViews
    RewriteEngine On
    RewriteBase /IIV/web/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ index.php [L]
</IfModule>

また、前述の @Maerlyn として .htaccess ルールをロードするように Apache が構成されていることを確認してください。

于 2013-10-24T06:25:22.313 に答える