.htaccess ile 404 ve 50x yönlendirme

28 Ağustos 2015
2 min read

Siteleriniz de bazen problemler meydana gelebiliyor veya olmayan bir sayfaya ulaşmaya çalışıldığında belirli hata sayfaları gösterilmekte. Peki tüm bu sayfaları sizin tasarımınız ile uyumlu ve sitenizin parçası gibi göstermek istemez misiniz?

Yapılması gereken işlem oldukça basit. html, php veya asp ile sitenize uygun şekilde 404 tasarımınızı oluşturuyorsunuz.

.htaccess dosyasına ise aşağıdaki kodları ekliyorsunuz

ErrorDocument 404 "görüntülenecek sayfa yolu"
ErrorDocument 400  "görüntülenecek sayfa yolu"
ErrorDocument 401  "görüntülenecek sayfa yolu"
ErrorDocument 403 "görüntülenecek sayfa yolu"
ErrorDocument 500  "görüntülenecek sayfa yolu"
ErrorDocument 501 "görüntülenecek sayfa yolu"
ErrorDocument 502 "görüntülenecek sayfa yolu"
ErrorDocument 503 "görüntülenecek sayfa yolu"

Bu kodlar bu şekilde devam ediyor peki ama bu sayfaların anlamı ne?

Informational

100 - Continue
101 - Switching Protocols

Successful
200 - OK
201 - Created
202 - Accepted
203 - Non-Authoritative Information
204 - No Content
205 - Reset Content
206 - Partial Content

Redirection
300 - Multiple Choices
301 - Moved Permanently
302 - Found
303 - See Other
304 - Not Modified
305 - Use Proxy
307 - Temporary Redirect

Client Error
400 - Bad Request
401 - Unauthorized
402 - Payment Required
403 - Forbidden
404 - Not Found
405 - Method Not Allowed
406 - Not Acceptable
407 - Proxy Authentication Required
408 - Request Timeout
409 - Conflict
410 - Gone
411 - Length Required
412 - Precondition Failed
413 - Request Entity Too Large
414 - Request-URI Too Long
415 - Unsupported Media Type
416 - Requested Range Not Satisfiable
417 - Expectation Failed

Server Error
500 - Internal Server Error
501 - Not Implemented
502 - Bad Gateway
503 - Service Unavailable
504 - Gateway Timeout
505 - HTTP Version Not Supported

Şeklinde hataları göstermektedir.

İyi çalışmalar.

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

This site uses Akismet to reduce spam. Learn how your comment data is processed.