2011-09-19 58 views
1

我不知道为什么会发生这种情况,但我可以访问html页面,而无需输入.html扩展名。这会导致重复的内容。与我的.htaccess文件帮助

例如:如果您在

http://www.math-aids.com/Addition/Single_Digit键入会去

http://www.math-aids.com/Addition/Single_Digit.html文件。

这发生在我所有的文件中。

我不希望发生这种情况。如果某人没有为文件输入.html,那么我希望它返回一个404错误“找不到文件”。

我该如何解决这个问题?我完全删除了.htaccess文件,它仍然发生。

这是我的.htaccess文件。

Options +FollowSymlinks 
rewriteengine on 
RewriteBase/

### re-direct IP address to www 
### re-direct non-www to www 
RewriteCond %{http_host} !^www.math-aids.com$ [nc] 
RewriteRule ^(.*)$ http://www.math-aids.com/$1 [r=301,nc,L] 

### re-direct index.html to root/### 
RewriteEngine on 
RewriteCond %{THE_REQUEST} ^.*\/index\.html?\ HTTP/ 
RewriteRule ^(.*)index\.html?$ "/$1" [R=301,L] 

### re-direct index.php to root/### 
RewriteCond %{THE_REQUEST} ^.*\/index\.php\ HTTP/ 
RewriteRule ^(.*)index\.php$ /$1 [R=301,L] 

### re-direct default.html to root/### 
RewriteCond %{THE_REQUEST} ^.*\/default\.html\ HTTP/ 
RewriteRule ^(.*)default\.html$ /$1 [R=301,L] 

### re-direct home.html to root/### 
RewriteCond %{THE_REQUEST} ^.*\/home\.html\ HTTP/ 
RewriteRule ^(.*)home\.html$ /$1 [R=301,L] 

### re-direct errors to error page 
ErrorDocument 404 /missing.html 

回答

0

我该如何解决这个问题?我完全删除了.htaccess文件,它仍然发生。

这是因为您发布的.htaccess文件不会将任何后缀追加.html。它必须是另一个.htaccess文件或您的主Apache配置。