2016-06-02 3 views
0

여기 내 htaccess 코드가 있습니다. 뭐가 문제 야? 404 오류가 작동하지 않지만 하단의 코드 (www를 삭제하고 root 용 index.html 변경)가 올바르게 작동합니다. 예를 들어 Google.com의 404 오류 URL을 변경하려고 시도했지만 작동하지도 않았습니다.HTACCESS가 작동하지 않는 이유는 무엇입니까?

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

아니요, 서버에있는 유일한 htaccess이며, 모든 내용을 붙여 넣었습니다. 어떤 생각? – larin555

+0

그냥 시도하고 작동하지 않습니다 :(다른 아이디어? 시도해 줘서 고마워요! – larin555

답변

0

당신은 예를 들어 전체 링크, 그냥 디렉토리를 포함 할 필요가 없습니다 :

ErrorDocument 404 /notfound.html 

또는 귀하의 경우

(404 페이지 루트에있는 경우) :

ErrorDocument 404 /404.html 
+0

고마워요,하지만 그것이 작동하지 않는 이유가 아니에요. "나는 할 필요가 없다"는 것을 알지만, 어느 쪽이든 올바르게 작동해야합니다. ? – larin555

+0

당신은 생각할 것입니다.하지만 비슷한 문제가 있었지만 변경 후에도 똑같은 문제가 있었을 것입니다. 테스트를 모두해볼 가치가 있습니다. – Lag

+0

방금 ​​시도했는데 작동하지 않습니다. 모든 리다이렉션은 아무것도로드하지 않고도 기본 브라우저 404 오류를 표시합니다. 감사합니다! – larin555

관련 문제