开发者

Help with my .htaccess file

I don't know why this is happening but I can access html pages WITHOUT typing in the .html extension. This is causing duplicate content.

Example: If you type in

http://www.math-aids.com/Addition/Single_Digitwill go to the

http://www.math-aids.com/Addition/Single_Digit.html file.

This is happening for all of my files.

I do not want that to happen. If someone does not type in the .html for a file, then I want it to return a 404 error " file not found ".

How can I fix this? I completely removed the .htaccess file and it still happens.

Here is my .htaccess file.

Options +FollowSymlinks
rewriteengine on
RewriteBase /

### re-direct IP address to ww开发者_高级运维w
### 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 


How can I fix this? I completely removed the .htaccess file and it still happens.

This is because the .htaccess file you posted doesn't append .html suffixes to anything. It must be another .htaccess file or something in your main Apache configuration.


It sounds like you have "Options MultiViews" somewhere in your Apache configuration (not the .htaccess file).

See http://httpd.apache.org/docs/2.0/mod/mod_negotiation.html#multiviews

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜