{"id":4603,"date":"2018-08-15T15:08:46","date_gmt":"2018-08-15T15:08:46","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2018\/08\/15\/easy-wordpress-hardening-in-the-htaccess-file\/"},"modified":"2024-04-19T11:25:02","modified_gmt":"2024-04-19T15:25:02","slug":"easy-wordpress-hardening-in-the-htaccess-file","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/","title":{"rendered":"Easy WordPress &#8220;Hardening&#8221; in the .htaccess File"},"content":{"rendered":"<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"538\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-1024x538.png\" alt=\"WordPress hardening in the htaccess file hero image\" class=\"wp-image-127513\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-1024x538.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-300x158.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-768x403.png 768w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File.png 1200w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure>\n\n\n\n<p>If you\u2019ve been following along with our many WordPress tutorials, your site is likely looking good and easy to use. But now you\u2019ll want to do some security \u201chardening\u201d to make your site more difficult for hackers to crack. In this article, we\u2019ll show you some neat things you can put in your <strong>.htaccess file<\/strong> to make your site more resilient to possible attacks.<\/p>\n\n\n\n<p>As always, editing the .htaccess file can be hazardous. Make sure to back up your site before attempting to make these changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"orge0b6c78\">WordPress \u201cHardening\u201d<\/h2>\n\n\n\n<p>Adding extra security features to your WordPress site is sometimes known as \u201chardening\u201d: you\u2019re essentially taking your existing site and adding on some extra armor against hackers. Because WordPress is customizable in this way, each site\u2019s security setup can be slightly different, keeping hackers guessing.<\/p>\n\n\n\n<p>The tips we\u2019re providing here are not required, and you may already have some security measures in place that make these null.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"org2f40453\">Require IP for Login Page<\/h2>\n\n\n\n<p>The <i>wp-login<\/i> page is a high value target for hackers. If a hacker or bot can guess your username\/password combination, they can gain access to the site. However, you can use your .htaccess file to <i>disallow<\/i> access to this page and <i>allow<\/i> traffic from a single IP:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"ErrorDocument 401 default\nErrorDocument 403 default\n\n&lt;Files wp-login.php&gt;\nOrder deny,allow\nDeny from all\nAllow from 192.0.2.1 localhost\n&lt;\/Files&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">ErrorDocument<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">401<\/span><span style=\"color: #E1E4E8\"> default<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">ErrorDocument<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">403<\/span><span style=\"color: #E1E4E8\"> default<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">&lt;<\/span><span style=\"color: #B392F0\">Files<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">wp-login.php<\/span><span style=\"color: #E1E4E8\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">Order<\/span><span style=\"color: #E1E4E8\"> deny,allow<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">Deny<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">from<\/span><span style=\"color: #E1E4E8\"> all<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">Allow<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">from<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">192<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">0<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">2<\/span><span style=\"color: #E1E4E8\">.<\/span><span style=\"color: #79B8FF\">1<\/span><span style=\"color: #E1E4E8\"> localhost<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">&lt;\/<\/span><span style=\"color: #B392F0\">Files<\/span><span style=\"color: #E1E4E8\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Source: <a href=\"https:\/\/codex.wordpress.org\/htaccess\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress.org<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"org980a210\">Deny Access to \u201cSensitive\u201d Files<\/h2>\n\n\n\n<p>Your WordPress installation contains several highly sensitive files such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The Configuration file (<i>wp-config.php<\/i>)<\/li>\n\n\n\n<li>The .htaccess file<\/li>\n\n\n\n<li>Error log file<\/li>\n\n\n\n<li>And more\u2026<\/li>\n<\/ul>\n\n\n\n<p>The code below can help protect those files:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"&lt;FilesMatch &quot;^.*(error_log|wp-config\\.php|php\\.ini|\\.[hH][tT][aApP].*)$&quot;&gt;\nOrder deny,allow\nDeny from all\n&lt;\/FilesMatch&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #E1E4E8\">&lt;<\/span><span style=\"color: #B392F0\">FilesMatch<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">\"^.*(error_log|wp-config\\.php|php\\.ini|\\.[hH][tT][aApP].*)$\"<\/span><span style=\"color: #E1E4E8\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">Order<\/span><span style=\"color: #E1E4E8\"> deny,allow<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">Deny<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">from<\/span><span style=\"color: #E1E4E8\"> all<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">&lt;\/<\/span><span style=\"color: #B392F0\">FilesMatch<\/span><span style=\"color: #E1E4E8\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Our <a href=\"https:\/\/www.inmotionhosting.com\/wordpress-vps\">WordPress VPS hosting packages<\/a> come with file protection, so you don\u2019t need to worry about this.<\/p>\n\n\n\n<p>Source: <a href=\"https:\/\/jetpack.com\/blog\/wordpress-htaccess-file\/\" target=\"_blank\" rel=\"noreferrer noopener\">Jetpack.com<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"orgfc82c55\">Require SSL<\/h2>\n\n\n\n<p>You\u2019ll want to make sure to take advantage our <a href=\"\/support\/website\/ssl\/auto-ssl-guide\/\">Free SSL<\/a> offer if you haven\u2019t install an SSL already. That done, you\u2019ll want to redirect all of your website traffic to the secure URL for your domain. WordPress has provided some code you can put in your .htaccess file to make that happen:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"SSLOptions +StrictRequire\nSSLRequireSSL\nSSLRequire %{HTTP_HOST} eq &quot;www.example.com&quot;\nErrorDocument 403 https:\/\/www.example.com\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">SSLOptions<\/span><span style=\"color: #E1E4E8\"> +StrictRequire<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">SSLRequireSSL<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">SSLRequire<\/span><span style=\"color: #E1E4E8\"> %{<\/span><span style=\"color: #FFAB70\">HTTP_HOST<\/span><span style=\"color: #E1E4E8\">} eq \"www.example.com\"<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">ErrorDocument<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">403<\/span><span style=\"color: #E1E4E8\"> https:\/\/www.example.com<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Just be sure to replace the information above with your own domain.<\/p>\n\n\n\n<p>Source: <a href=\"https:\/\/codex.wordpress.org\/htaccess\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress.org<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Secure the wp-includes Folder<\/h2>\n\n\n\n<p>An additional layer of security can be implemented to restrict access to scripts that are typically not meant for user interaction. This can be achieved by using mod_rewrite to block these scripts in the .htaccess file.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:clamp(16px, 1rem, 24px);font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:clamp(26px, 1.625rem, 39px);--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"# Block the include-only files.\n&lt;IfModule mod_rewrite.c&gt;\nRewriteEngine On\nRewriteBase \/\nRewriteRule ^wp-admin\/includes\/ - [F,L]\nRewriteRule !^wp-includes\/ - [S=3]\nRewriteRule ^wp-includes\/[^\/]+\\.php$ - [F,L]\nRewriteRule ^wp-includes\/js\/tinymce\/langs\/.+\\.php - [F,L]\nRewriteRule ^wp-includes\/theme-compat\/ - [F,L]\n&lt;\/IfModule&gt;\n# BEGIN WordPress\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #6A737D\"># Block the include-only files.<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">&lt;<\/span><span style=\"color: #B392F0\">IfModule<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">mod_rewrite.c<\/span><span style=\"color: #E1E4E8\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">RewriteEngine<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">On<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">RewriteBase<\/span><span style=\"color: #E1E4E8\"> \/<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">RewriteRule<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #DBEDFF\">^wp-admin\/includes\/<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">-<\/span><span style=\"color: #E1E4E8\"> [F,L]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">RewriteRule<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #DBEDFF\">!^wp-includes\/<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">-<\/span><span style=\"color: #E1E4E8\"> [S=<\/span><span style=\"color: #79B8FF\">3<\/span><span style=\"color: #E1E4E8\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">RewriteRule<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #DBEDFF\">^wp-includes\/[^\/]+\\.php$<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">-<\/span><span style=\"color: #E1E4E8\"> [F,L]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">RewriteRule<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #DBEDFF\">^wp-includes\/js\/tinymce\/langs\/.+\\.php<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">-<\/span><span style=\"color: #E1E4E8\"> [F,L]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">RewriteRule<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #DBEDFF\">^wp-includes\/theme-compat\/<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">-<\/span><span style=\"color: #E1E4E8\"> [F,L]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">&lt;\/<\/span><span style=\"color: #B392F0\">IfModule<\/span><span style=\"color: #E1E4E8\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #6A737D\"># BEGIN WordPress<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Source: <a href=\"https:\/\/developer.wordpress.org\/advanced-administration\/security\/hardening\/\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress.org<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"orgc345032\">If Anything Should Break<\/h2>\n\n\n\n<p>Any time you edit the .htaccess file, problems can occur. Your WordPress site requires a fully functional .htaccess file for various important functions. We recommend adding the code snippets provided here under the standard WordPress .htaccess code.<\/p>\n\n\n\n<p>And, if anything breaks, remove any of your custom code and copy the default .htaccess snippet from <a href=\"https:\/\/codex.wordpress.org\/htaccess\" target=\"_blank\" rel=\"noreferrer noopener\">WordPress.org<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you&#8217;ve been following along with our many WordPress tutorials, your site is likely looking good and easy to use. But now you&#8217;ll want to do some security &#8220;hardening&#8221; to make your site more difficult for hackers to crack. In this article, we&#8217;ll show you some neat things you can put in your .htaccess file<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57014,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4288,4325,56],"tags":[],"class_list":["post-4603","post","type-post","status-publish","format-standard","hentry","category-website","category-wordpress-hosting","category-wordpress"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Harden &amp; Secure WordPress in the .htaccess File<\/title>\n<meta name=\"description\" content=\"In this article, we&#039;ll introduce some basic code snippets you can use to harden and secure WordPress through the server&#039;s .htaccess file.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Harden &amp; Secure WordPress in the .htaccess File\" \/>\n<meta property=\"og:description\" content=\"In this article, we&#039;ll introduce some basic code snippets you can use to harden and secure WordPress through the server&#039;s .htaccess file.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2018-08-15T15:08:46+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-19T15:25:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-1024x538.png\" \/>\n<meta name=\"author\" content=\"InMotion Hosting Contributor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InMotion Hosting Contributor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/\"},\"author\":{\"name\":\"InMotion Hosting Contributor\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\"},\"headline\":\"Easy WordPress &#8220;Hardening&#8221; in the .htaccess File\",\"datePublished\":\"2018-08-15T15:08:46+00:00\",\"dateModified\":\"2024-04-19T15:25:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/\"},\"wordCount\":458,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-1024x538.png\",\"articleSection\":[\"Website\",\"WordPress Hosting\",\"WordPress Tutorials\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/\",\"name\":\"How to Harden & Secure WordPress in the .htaccess File\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-1024x538.png\",\"datePublished\":\"2018-08-15T15:08:46+00:00\",\"dateModified\":\"2024-04-19T15:25:02+00:00\",\"description\":\"In this article, we'll introduce some basic code snippets you can use to harden and secure WordPress through the server's .htaccess file.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#primaryimage\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File.png\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File.png\",\"width\":1200,\"height\":630,\"caption\":\"WordPress hardening in the htaccess file hero image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Easy WordPress &#8220;Hardening&#8221; in the .htaccess File\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644\",\"name\":\"InMotion Hosting Contributor\",\"description\":\"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!\",\"sameAs\":[\"https:\/\/www.linkedin.com\/company\/inmotion-hosting\/\",\"https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Harden & Secure WordPress in the .htaccess File","description":"In this article, we'll introduce some basic code snippets you can use to harden and secure WordPress through the server's .htaccess file.","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:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/","og_locale":"en_US","og_type":"article","og_title":"How to Harden & Secure WordPress in the .htaccess File","og_description":"In this article, we'll introduce some basic code snippets you can use to harden and secure WordPress through the server's .htaccess file.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2018-08-15T15:08:46+00:00","article_modified_time":"2024-04-19T15:25:02+00:00","og_image":[{"url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-1024x538.png","type":"","width":"","height":""}],"author":"InMotion Hosting Contributor","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"InMotion Hosting Contributor","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/"},"author":{"name":"InMotion Hosting Contributor","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644"},"headline":"Easy WordPress &#8220;Hardening&#8221; in the .htaccess File","datePublished":"2018-08-15T15:08:46+00:00","dateModified":"2024-04-19T15:25:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/"},"wordCount":458,"commentCount":2,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-1024x538.png","articleSection":["Website","WordPress Hosting","WordPress Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/","name":"How to Harden & Secure WordPress in the .htaccess File","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#primaryimage"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File-1024x538.png","datePublished":"2018-08-15T15:08:46+00:00","dateModified":"2024-04-19T15:25:02+00:00","description":"In this article, we'll introduce some basic code snippets you can use to harden and secure WordPress through the server's .htaccess file.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#primaryimage","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File.png","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2024\/04\/WordPress-Hardening-in-the-.htaccess-File.png","width":1200,"height":630,"caption":"WordPress hardening in the htaccess file hero image"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/easy-wordpress-hardening-in-the-htaccess-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"Easy WordPress &#8220;Hardening&#8221; in the .htaccess File"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/f9a4fc454cd1df128ee8e898d30d4644","name":"InMotion Hosting Contributor","description":"InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!","sameAs":["https:\/\/www.linkedin.com\/company\/inmotion-hosting\/","https:\/\/x.com\/https:\/\/twitter.com\/InMotionHosting"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/inmotion-hosting-contributor\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":4288,"name":"Website","slug":"website","link":"https:\/\/www.inmotionhosting.com\/support\/website\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/57014"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=4603"}],"version-history":[{"count":3,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4603\/revisions"}],"predecessor-version":[{"id":127661,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/4603\/revisions\/127661"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=4603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=4603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=4603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}