只是想知道是否有人会好心地查看我的 htaccess 代码并告诉我是否有任何看起来明显不正确的内容。我对这些东西了解不多。也不确定这些部件是否应该以不同的方式组织,或者是否有必要将“RewriteEngine on RewriteBase /”不止一次地放在那里?无论如何,这里是代码:
RewriteEngine on
RewriteBase /
RewriteRule ^(.+)\.shtml$ $1.html [R=301,L]
redirect 301 /games.html http://www.slimekids.com/games/
redirect 301 /trailers.html http://www.slimekids.com/book-trailers/
redirect 301 /authors.html http://www.slimekids.com/authors/
redirect 301 /reference.html http://www.slimekids.com/reference/
redirect 301 /reviews.html http://www.slimekids.com/book-reviews/
redirect 301 /searches.html http://www.slimekids.com/search-engines/
RewriteEngine on
RewriteBase /
#if the domain is not www.slimekids.com
RewriteCond %{HTTP_HOST} !^www\.slimekids\.com$ [NC]
#redirect to www.slimekids.com
RewriteRule ^(.*)$ http://www.slimekids.com/$1 [L,R=301]
#leave this rule in place, but after the one above to handle the home page
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://www.slimekids.com/ [R=301,L]
ErrorDocument 404 /404page.html
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES CACHING ##