Share this Article !

How to Add HTTP Security Headers in WordPress

What Are HTTP Security Headers?

With the use of HTTP security headers, your website’s server can thwart typical security risks before they have a chance to compromise your website.

Your web server replies to the user’s browser with an HTTP header when they visit your WordPress website. Browsers can learn about error codes, cache control, and other statuses from this response.

A status known as HTTP 200 is returned by the standard header response. The user’s browser then loads your webpage. On the other hand, your web server might transmit an alternative HTTP header if your website is experiencing problems.

Let’s quickly review some HTTP security headers and their role in safeguarding your WordPress website:

Web browsers are informed by HTTP Strict Transport Security (HSTS) that your website uses HTTPS and shouldn’t be loaded via an insecure protocol like HTTP.

  • Header set Content-Security-Policy “upgrade-insecure-requests”
  • Header set Strict-Transport-Security “max-age=31536000; includeSubDomains”
  • Header set X-Xss-Protection “1; mode=block”
  • Header set X-Frame-Options “SAMEORIGIN”
  • Header set X-Content-Type-Options “nosniff”
  • Header set Referrer-Policy “strict-origin-when-cross-origin” Header set Permissions-Policy “geolocation=self”

How to Add HTTP Security Headers in wp .htaccess

.htaccess

#header security
<IfModule mod_headers.c>
Header set Content-Security-Policy "upgrade-insecure-requests"
Header set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header set X-Xss-Protection "1; mode=block"
Header set X-Frame-Options "SAMEORIGIN"
Header set X-Content-Type-Options "nosniff"
Header set Referrer-Policy "strict-origin-when-cross-origin"
Header set Permissions-Policy "geolocation=self"
</IfModule>
#end header security

How to Check HTTP Security Headers for a Website

To check your website’s score, click this link: https://securityheaders.com/.

Share this Article !


You may like this
Top 10 most popular programming language in 2025

Top 10 most popular programming language in 2025

Nowadays, we know and see coding skills hold immense value in technology beyond 1990 till 2025, with effects on career advancement being profound. Extremely popular languages such as Python, JavaScript, and Java...
Top 11 Testing methodologies for web application security

Top 11 Testing methodologies for web application security

Web app security testing methodologies make sure that apps are strong against prospective weaknesses and threats. Here are some of the most popular and useful methodologies:
how to improve seo and increase audience for your website

how to improve seo and increase audience for your website

To increase your audience and boost your SEO (Search Engine Optimization), you’ll need to implement a mix of technical strategies, content creation, and marketing campaigns. This is a step-by-step guide to help...
Beware of new scams by remote control (Wireless paring)-Social engineering

Beware of new scams by remote control (Wireless paring)-Social engineering

Considerable online activity surge necessitates awareness of lurking scams, phishing schemes, and other cyber threats that exploit electronic devices. Fraudsters and cybercrooks often get hold of your address, phone number, and other...
Moodle – how get total course completed and login chart in current year into dashboard page

Moodle – how get total course completed and login chart in current year into dashboard page

To add the total course completed and login chart in the current year to the dashboard, you need to get a query from course complete and login from the database. We created...
(100% worked) How to fix PHP is not recognized as an internal or external command for Xampp Or Wamp

(100% worked) How to fix PHP is not recognized as an internal or external command for Xampp Or Wamp

5 steps for fixing PHP is not recognized as an internal or external command for Xampp rr Wamp. You can follow the tips below. Go to My Computer->properties -> Advanced system setting->...