0

htaccessに問題があります

URLをphpからhtmlに変換します

ただし、ドメイン内のサブフォルダーがすべてurlをhtmlに変換する場合

サブフォルダーではなく、ドメイン conert url だけが必要です

これは私のコードです

RewriteCond %{REQUEST_URI} !^(.*)form.php(.*)$
RewriteCond %{THE_REQUEST} ^[A-Z]+\s([^\s]+)\.php\s
RewriteCond %{REQUEST_URI} !^(.*)form.php(.*)$
RewriteRule .* %1.html [R=301,L]
RewriteRule ^(.*)\.html$ $1.php
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^.*$ - [L]
RewriteRule ^index.php$ http://%{http_host} [R=301,L]
4

1 に答える 1

0

ルールを次のように変更します。

RewriteCond %{REQUEST_URI} !^(.*)form.php(.*)$
RewriteCond %{REQUEST_URI} !^(.*)sitemap\.xml(.*)$
RewriteCond %{THE_REQUEST} ^[A-Z]+\s([^/]+)\.php\s
RewriteRule .* %1.html [R=301,L]
RewriteRule ^([^/]*)\.html$ $1.php
RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^.*$ - [L]
RewriteRule ^index.php$ http://%{http_host} [R=301,L]
于 2012-09-12T15:37:45.090 に答える