{"id":3667,"date":"2017-11-07T13:11:07","date_gmt":"2017-11-07T10:11:07","guid":{"rendered":"https:\/\/malware.expert\/?p=3667"},"modified":"2017-11-07T13:11:07","modified_gmt":"2017-11-07T10:11:07","slug":"custom-modsecurity-error-message-in-apache","status":"publish","type":"post","link":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/","title":{"rendered":"Custom ModSecurity Error message in apache"},"content":{"rendered":"<p>This tutorial we show that you can change the custom error message page to ModSecurity. Typically, you get 403 or 406 Response code when ModSecurity block access to website.<\/p>\n<h2>Apache configuration<\/h2>\n<p>In apache configuration files (Depend your OS &#038; Configuration)<\/p>\n<p><em><strong>includes \/ errordocument.conf<\/strong><\/em><\/p>\n<pre>\r\nErrorDocument 403 \/403.shtml\r\n<\/pre>\n<p>Add extra row to 406 error page:<\/p>\n<pre>\r\nErrorDocument 406 \/406.shtml\r\n<\/pre>\n<h2>Modsecurity SecDefaultAction<\/h2>\n<p>Setup ModSecurity Default action to 406 in ModSecurity configuration file:<\/p>\n<pre>\r\nSecDefaultAction \"phase:1,deny,log,status:406\"\r\nSecDefaultAction \"phase:2,deny,log,status:406\"\r\n<\/pre>\n<h2>Apache 406.shtml<\/h2>\n<p>Now you can create custom 406.shtml file in apache root directory <em><strong>\/var\/www\/html\/406.shtml<\/strong><\/em> what you want.<\/p>\n<h3>Restart apache<\/h3>\n<p>Remember restart apache:<\/p>\n<pre>\r\n# apache2ctl graceful\r\n<\/pre>\n<h2>Final Words<\/h2>\n<p>If you don&#8217;t wanna build own rules, you can use Malware Expert &#8211; <a href=\"https:\/\/malware.expert\/modsecurity-rules\/\">ModSecurity rules<\/a> to protect your web server vulnerabilities and attacks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial we show that you can change the custom error message page to ModSecurity. Typically, you get 403 or 406 Response code when ModSecurity block access to website. Apache configuration In apache configuration files (Depend your OS &#038; Configuration) includes \/ errordocument.conf ErrorDocument 403 \/403.shtml Add extra row to 406 error page: ErrorDocument 406 &#8230; <a title=\"Custom ModSecurity Error message in apache\" class=\"read-more\" href=\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/\" aria-label=\"Read more about Custom ModSecurity Error message in apache\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":3063,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[74],"tags":[1353,1354,16,1024,1356,1350,18,1351],"class_list":["post-3667","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial","tag-1353","tag-1354","tag-apache","tag-error","tag-errordocument","tag-message","tag-modsecurity","tag-secdefaultaction"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.7.1 (Yoast SEO v26.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Custom ModSecurity Error message in apache<\/title>\n<meta name=\"description\" content=\"This tutorial we show that you can change the custom error message page to ModSecurity. Typically, you get 403 or 406 Response code when ModSecurity blocks.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Custom ModSecurity Error message in apache\" \/>\n<meta property=\"og:description\" content=\"This tutorial we show that you can change the custom error message page to ModSecurity. Typically, you get 403 or 406 Response code when ModSecurity blocks.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/\" \/>\n<meta property=\"og:site_name\" content=\"Malware Expert\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Malware.Expert\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-11-07T10:11:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Malware__Expert\" \/>\n<meta name=\"twitter:site\" content=\"@Malware__Expert\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/malware.expert\/#\/schema\/person\/1016f76dbc76823a9aba2ba8f14abfd3\"},\"headline\":\"Custom ModSecurity Error message in apache\",\"datePublished\":\"2017-11-07T10:11:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/\"},\"wordCount\":114,\"publisher\":{\"@id\":\"https:\/\/malware.expert\/#organization\"},\"image\":{\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png\",\"keywords\":[\"403\",\"406\",\"apache\",\"error\",\"errordocument\",\"message\",\"modsecurity\",\"SecDefaultAction\"],\"articleSection\":[\"tutorial\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/\",\"url\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/\",\"name\":\"Custom ModSecurity Error message in apache\",\"isPartOf\":{\"@id\":\"https:\/\/malware.expert\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png\",\"datePublished\":\"2017-11-07T10:11:07+00:00\",\"description\":\"This tutorial we show that you can change the custom error message page to ModSecurity. Typically, you get 403 or 406 Response code when ModSecurity blocks.\",\"breadcrumb\":{\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#primaryimage\",\"url\":\"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png\",\"contentUrl\":\"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png\",\"width\":1200,\"height\":628,\"caption\":\"Tutorial\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/malware.expert\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"tutorial\",\"item\":\"https:\/\/malware.expert\/category\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Custom ModSecurity Error message in apache\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/malware.expert\/#website\",\"url\":\"https:\/\/malware.expert\/\",\"name\":\"Malware Expert\",\"description\":\"ModSecurity rules\",\"publisher\":{\"@id\":\"https:\/\/malware.expert\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/malware.expert\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/malware.expert\/#organization\",\"name\":\"Malware Expert\",\"url\":\"https:\/\/malware.expert\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/malware.expert\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/malware.expert\/wp-content\/uploads\/2023\/08\/cropped-malware_express_header_logo.png\",\"contentUrl\":\"https:\/\/malware.expert\/wp-content\/uploads\/2023\/08\/cropped-malware_express_header_logo.png\",\"width\":408,\"height\":82,\"caption\":\"Malware Expert\"},\"image\":{\"@id\":\"https:\/\/malware.expert\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Malware.Expert\/\",\"https:\/\/x.com\/Malware__Expert\"],\"publishingPrinciples\":\"https:\/\/malware.expert\/editorial-guidelines\/\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/malware.expert\/#\/schema\/person\/1016f76dbc76823a9aba2ba8f14abfd3\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/malware.expert\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/76c5b003c7f6492ce413d3ad91151c1d648c58e54c5b360eeb19eec3562a0393?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/76c5b003c7f6492ce413d3ad91151c1d648c58e54c5b360eeb19eec3562a0393?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/willberg.me\"],\"url\":\"https:\/\/malware.expert\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Custom ModSecurity Error message in apache","description":"This tutorial we show that you can change the custom error message page to ModSecurity. Typically, you get 403 or 406 Response code when ModSecurity blocks.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/","og_locale":"en_US","og_type":"article","og_title":"Custom ModSecurity Error message in apache","og_description":"This tutorial we show that you can change the custom error message page to ModSecurity. Typically, you get 403 or 406 Response code when ModSecurity blocks.","og_url":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/","og_site_name":"Malware Expert","article_publisher":"https:\/\/www.facebook.com\/Malware.Expert\/","article_published_time":"2017-11-07T10:11:07+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png","type":"image\/png"}],"author":"admin","twitter_card":"summary_large_image","twitter_creator":"@Malware__Expert","twitter_site":"@Malware__Expert","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#article","isPartOf":{"@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/"},"author":{"name":"admin","@id":"https:\/\/malware.expert\/#\/schema\/person\/1016f76dbc76823a9aba2ba8f14abfd3"},"headline":"Custom ModSecurity Error message in apache","datePublished":"2017-11-07T10:11:07+00:00","mainEntityOfPage":{"@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/"},"wordCount":114,"publisher":{"@id":"https:\/\/malware.expert\/#organization"},"image":{"@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#primaryimage"},"thumbnailUrl":"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png","keywords":["403","406","apache","error","errordocument","message","modsecurity","SecDefaultAction"],"articleSection":["tutorial"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/","url":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/","name":"Custom ModSecurity Error message in apache","isPartOf":{"@id":"https:\/\/malware.expert\/#website"},"primaryImageOfPage":{"@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#primaryimage"},"image":{"@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#primaryimage"},"thumbnailUrl":"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png","datePublished":"2017-11-07T10:11:07+00:00","description":"This tutorial we show that you can change the custom error message page to ModSecurity. Typically, you get 403 or 406 Response code when ModSecurity blocks.","breadcrumb":{"@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#primaryimage","url":"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png","contentUrl":"https:\/\/malware.expert\/wp-content\/uploads\/2017\/06\/Malware_Expert_tutorial.png","width":1200,"height":628,"caption":"Tutorial"},{"@type":"BreadcrumbList","@id":"https:\/\/malware.expert\/tutorial\/custom-modsecurity-error-message-in-apache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/malware.expert\/"},{"@type":"ListItem","position":2,"name":"tutorial","item":"https:\/\/malware.expert\/category\/tutorial\/"},{"@type":"ListItem","position":3,"name":"Custom ModSecurity Error message in apache"}]},{"@type":"WebSite","@id":"https:\/\/malware.expert\/#website","url":"https:\/\/malware.expert\/","name":"Malware Expert","description":"ModSecurity rules","publisher":{"@id":"https:\/\/malware.expert\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/malware.expert\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/malware.expert\/#organization","name":"Malware Expert","url":"https:\/\/malware.expert\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/malware.expert\/#\/schema\/logo\/image\/","url":"https:\/\/malware.expert\/wp-content\/uploads\/2023\/08\/cropped-malware_express_header_logo.png","contentUrl":"https:\/\/malware.expert\/wp-content\/uploads\/2023\/08\/cropped-malware_express_header_logo.png","width":408,"height":82,"caption":"Malware Expert"},"image":{"@id":"https:\/\/malware.expert\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Malware.Expert\/","https:\/\/x.com\/Malware__Expert"],"publishingPrinciples":"https:\/\/malware.expert\/editorial-guidelines\/"},{"@type":"Person","@id":"https:\/\/malware.expert\/#\/schema\/person\/1016f76dbc76823a9aba2ba8f14abfd3","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/malware.expert\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/76c5b003c7f6492ce413d3ad91151c1d648c58e54c5b360eeb19eec3562a0393?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/76c5b003c7f6492ce413d3ad91151c1d648c58e54c5b360eeb19eec3562a0393?s=96&d=mm&r=g","caption":"admin"},"sameAs":["http:\/\/willberg.me"],"url":"https:\/\/malware.expert\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/posts\/3667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/comments?post=3667"}],"version-history":[{"count":6,"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/posts\/3667\/revisions"}],"predecessor-version":[{"id":22638,"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/posts\/3667\/revisions\/22638"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/media\/3063"}],"wp:attachment":[{"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/media?parent=3667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/categories?post=3667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/malware.expert\/wp-json\/wp\/v2\/tags?post=3667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}