这是我的htaccess代码。怎么了? 404错误无法正常工作,但底部的代码(删除www并更改root.html的index.html)运行正常。我尝试更改Google.com的404错误网址,但它也无法正常工作。
ErrorDocument 404 http://example.com/404.html
Redirect 301 /location_entrepots.html http://example.com/index.html
Redirect 301 /mini_entrepots_residentiel.html http://example.com/nos-entrepots.html
Redirect 301 /mini_entrepots_commercial.html http://example.com/nos-entrepots.html
Redirect 301 /bureaux_a_louer.html http://example.com/bureaux-a-louer.html
Redirect 301 /visitevirtuelle.html http://example.com/medias.html
Redirect 301 /video.html http://example.com/medias.html
Redirect 301 /location_entrepots_dimensions.html http://example.com/nos-entrepots.html
Redirect 301 /location_camions.html http://example.com/location-de-camions.html
Redirect 301 /information_location_entrepots.html http://example.com/contact.html
Redirect 301 /contactez_nous.html http://example.com/contact.html
Redirect 301 /promotions.html http://example.com/index.html
Redirect 301 /storage_units_welcome.html http://example.com/en/home.html
Redirect 301 /residential_storage_units.html http://example.com/en/storage-units.html
Redirect 301 /commercial_storage_units.html http://example.com/en/storage-units.html
Redirect 301 /office_rental.html http://example.com/en/office-rental.html
Redirect 301 /virtualvisit.html http://example.com/en/medias.html
Redirect 301 /video_en.html http://example.com/en/medias.html
Redirect 301 /storage_rental_units_dimensions.html http://example.com/en/storage-units.html
Redirect 301 /truck_rental.html http://example.com/en/truck-rental.html
Redirect 301 /storage_rental_units_informations.html http://example.com/en/contact.html
Redirect 301 /contact_us.html http://example.com/en/contact.html
Redirect 301 /promotions_en.html http://example.com/en/home.html
RewriteEngine On
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^(.*)/index\.html$ /$1/ [R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
答案 0 :(得分:0)
您不需要包含完整链接,只需包含目录,例如:
ErrorDocument 404 /notfound.html
或在您的情况下(如果您的404页面在您的根目录上):
ErrorDocument 404 /404.html