私のホスティングアカウントには、ドメインがあります。1つはルートにあり、もう1つは/example/フォルダーにあります。これが私のメインの.htaccessファイルのリダイレクトコードです。これは、今説明した関数とは別に正常に機能します。この機能は以前は機能していましたが、不思議なことに停止しました-
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^/example(.*)$ http://example.com/$1 [R=301,L]
# Rewrite /example to http://example.com
# Remove .php from file names and force added slash
# http://stackoverflow.com/questions/1068595/htaccess-code-to-remove-extension-and-addforce-trailing-slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php
RewriteRule (.*)\.php$ /$1/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)/$ $1.php [L]
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule .*[^/]$ $0/ [L,R=301]
何か案は?