現在、MAMP でローカルホストを使用しています。.htaccess ファイルの URL の書き換えを許可する適切な方法を読んで調査し、成功しました。しかし、現在、ファイルはリンクを希望どおりにフォーマットしていません。たとえば、 と の 3 つのページindex.php
が about.php
ありcontact
ます。サイトのフレーム作業に MVC を使用しています。これは、.htaccess ファイルまたはローカル サーバーのコードに問題がありますか?
現在、あるページから別のページに移動する場合、リンクは次のようになります。
localhost/mvc/index.php?
localhost/mvc/index.php?p=about
localhost/mvc/index.php?p=contact
.htaccess は、リンクを次のようにフォーマットする必要があります。
localhost/mvc/index/?
localhost/mvc/about/?
localhost/mvc/contact/?
.htaccess:
<IfModule mod_rewrite.c>
# Turn on the engine:
RewriteEngine on
# Set the base to this directory:
RewriteBase /mvc/
# Redirect certain paths to index.php:
RewriteRule ^(about|contact|this|that|search)/?$ index.php?p=$1
</IfModule>