.htaccess書き換えが機能しませんか?

.htaccess書き換えが機能しませんか?

/etc/apache2/vhosts.d/ip-based_vhosts.confに次の仮想ホストがあります。

<VirtualHost test.local:80>
ServerAdmin [email protected]
ServerName test.local
DocumentRoot /home/web/test.net/html

ErrorLog /var/log/apache2/test-error.log
CustomLog /var/log/apache2/test-access.log combined

HostnameLookups Off
UseCanonicalName Off
ServerSignature On

<Directory "/home/web/test.net/html">
  Options Indexes FollowSymLinks
  AllowOverride All

  <IfModule !mod_access_compat.c>
  Require all granted
  </IfModule>
  <IfModule mod_access_compat.c>
  Order allow,deny
  Allow from all
  </IfModule>
  DirectoryIndex index.php
</Directory>
<IfModule proxy_fcgi_module>
  ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/home/web/test.net/html/$1
 </IfModule>
</VirtualHost>

/home/web/test.net/htmlには次のものがあります。

.htaccess

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>

index.php

<?php echo $_SERVER['REQUEST_URI']; ?>

私が訪れるときhttp://test.local「/」が正しく表示されます(引用符を除く)。

しかし、私が次のようなものにアクセスした場合http://test.local/abc「/abc」の代わりに404ページが表示されます。

この問題が正しく機能するように修正するにはどうすればよいですか?

ベストアンサー1

次の点を確認する必要があります。

  • ファイルに.htaccess適切な権限がありますか?
  • mod_rewrite有効かどうか

おすすめ記事