更新された .htaccess ファイルの簡単な確認が必要です:
RewriteEngine On
# Redirects errors to 404 page
ErrorDocument 404 /404.php
# Redirect index.php to site root
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,NC]
RewriteRule ^index.php$ http://www.mysite.com/ [R=301,L]
# Unless directory remove slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://www.mysite.com/$1 [R=301,L]
# Remove .php
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://www.mysite.com/$1 [R=301,L]
# Resolve .php file for extensionless php urls
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/.]+)$ $1.php [L]
それはかなり簡単です。
1 つ目は 404 リダイレクトです。
2 番目は www.mysite.com/index.php を www.mysite.com にリダイレクトします。3
番目はスラッシュを削除します。4 番目は .php 拡張子を削除します。5 番目は php を解決します。
誰かがこれに目を向けて、私のコードに簡単な健全性チェックをしてください。