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.
htaccessファイルでURLから.php拡張子を削除したい。教えてくださいどうすればいいですか??
url:http://domain name/profile.php
私はこのようにしたい
url:http://domain name/profile
正規表現を記述して .htaccess をさまざまな方法で使用できるようにするには、それを読む必要がありますが、単純な書き直しは次のようになります。
RewriteEngine on RewriteRule ^profile$ profile.php [L]
すべての .php 拡張子をグローバルに削除するが、ファイル名は保持したい場合は、次のような正規表現が必要になります。
RewriteRule ^([a-zA-Z0-9\-_]+).php$ $1.php [L]