作成する Web ページ用に独自の MVC スタイル システムを開発しています。ファイル構造は次のとおりです。
docs/contact/contact.php
img/
inc/
index.php
.htaccess
Docs 内には、Web サイトの各セクションのフォルダーがあります。この場合、「連絡先」を展開しました。.htaccess ファイルはすべての URI を index.php にルーティングしますが、それらが直接アクセスされる場合、つまり domain.com/docs/contact/contact.php にはルーティングされません。
これは私の .htaccess です:
Options +FollowSymlinks
RewriteEngine on
RewriteOptions MaxRedirects=10
AddType "text/html; charset=UTF-8" html
AddType "text/plain; charset=UTF-8" txt
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# if file not exists
RewriteCond %{REQUEST_FILENAME} !-f
# if dir not exists
RewriteCond %{REQUEST_FILENAME} !-d
# avoid 404s of missing assets in our script
RewriteCond %{REQUEST_URI} !^.*\.(jpe?g|png|gif|css|js)$ [NC]
RewriteRule .* index.php [QSA,L]
</IfModule>
ファイル index.php から直接呼び出されない限り、人々が docs フォルダ内のファイルにアクセスできないようにする方法はありますか? これは .htaccess で実行できますか?