Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
この質問では、誰かがphpファイルにアクセスせずに特定のタイプのURL書き換えを行うことが可能かどうか尋ねました。(詳細については、質問を参照してください。)phpファイルにアクセスしてこれを行うにはどうすればよいですか?
これをhtaccessファイルに使用できます。
RewriteEngine on RewriteBase / RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php
つまり、js、ico、txt、gif、jpg、png、またはcssで終わらないリクエストをindex.phpファイルに書き換えます。index.phpでは、を使用して任意のパラメーターにアクセス$_SERVER['REQUEST_URI']し、必要に応じて解析できます。
$_SERVER['REQUEST_URI']