Tuesday, March 21, 2023
  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Podcasts
  • Web Hosting Directory
  • Login
  • Register
Cloud7 News
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Software
    • Network/Internet
    • Hardware
    • Artificial Intelligence
    • Windows
    • Policy/Legislation
    • Blockchain
    • Troubleshooting
    • How-Tos
    • Articles
No Result
View All Result
Cloud7 News
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Software
    • Network/Internet
    • Hardware
    • Artificial Intelligence
    • Windows
    • Policy/Legislation
    • Blockchain
    • Troubleshooting
    • How-Tos
    • Articles
No Result
View All Result
Cloud7 News
No Result
View All Result

Home > How-Tos > How to add HTTP security headers on WordPress

How to add HTTP security headers on WordPress

If you are using WordPress and you care about the security of your website, you can take extra security measures on the HTTP header.


Rusen Gobel Rusen Gobel
November 19, 2022
3 min read
How to add HTTP security headers on WordPress

When users visit your website, their browsers send HTTP requests to target websites’ servers. Then, the target server sends back HTTP response data. In this response, there is a part of the data that includes information and settings about performance, security, and the content of the website.

In this rule set, there are different rules such as performance, security, and connection. In this article, we will explain how you can take security measures on possible attacks such as cross-site scripting, brute force attacks, clickjacking, and how to view your site’s rules.


Table of Contents

  • HTTP security header settings in WordPress
    • HTTP Strict-Transport-Security (HSTS)
    • X-XSS-Protection
    • X-Frame-Options
    • X-Content-Type-Options
  • How to check the security headers on a website?
    • Checking via Security Headers website
    • Checking via terminal command
  • How to add HTTP security headers on a WordPress website?

HTTP security header settings in WordPress

First, let’s talk about subsets that can be added to the HTTP header.

HTTP Strict-Transport-Security (HSTS)

HTTP Strict Transport Security header allows HTTPS to be used by rejecting requests that call your website as HTTP. In this way, the connection between the client and the server is encrypted and the clients can browse your website securely.

If you want to check your site’s HSTS setting, you can follow the link below:

HSTS Preload

X-XSS-Protection

X-XSS Protection header prevents cross-site scripting attacks on your site. In this way, you will protect your site from many possible attacks.

X-Frame-Options

X-Frame-Options is a header security set that prevents cyber attack attacks known as clickjacking or UI Redressing.

Possible options

X-Frame-Options: DENY | SAMEORIGIN | ALLOW-FROM (URL)

X-Content-Type-Options

X-Content-Type-Options prevents tracking and changing mime-types in the response header sent by the server.


How to check the security headers on a website?

Checking via Security Headers website

If you want to check the headers activated on your website before applying the above security steps, you can follow the link below: 

Security Headers

SecurityHeaders.comChecking via terminal command

You can also use the Linux terminal command below to check any website’s security header settings:

curl -head http://websitename.com

curl --head


How to add HTTP security headers on a WordPress website?

Use a file manager to navigate to /wp-content/themes/<current-theme> on your WordPress files in the server, then add the following command into the functions.php file:

add_filter(‘wp_headers’, function($headers){
    $headers[‘Strict-Transport-Security’] = ‘max-age=63072000; includeSundomains; preload’;
    $headers[‘X-XXS-Protection’] = ‘1; mode=block’;
    $headers[‘X-Frame-Options’] = ‘DENY’;
    $headers[‘X-Content-Type-Options’] = ‘nosniff’;
    $headers[‘Referrer-Policy’] = ‘no-referrer’;
    return $headers;
}, 999);

While enhancing security through HTTP headers at a basic level is as simple as that, we will deliver extended information about those headers, what they actually do, and their settings. So, stay tuned.

Rusen Gobel

Rusen Gobel

Rusen Gobel is the managing editor of Cloud7. With more than 10 years of experience, Rusen worked as a hardware and software news editor for technology sites such as ShiftDelete, Teknokulis, Hardware Plus, BT Haber. In addition, Rusen publishes consumer product reviews on his YouTube channel. While consumer electronics has been his main focus for years, now Rusen is more interested in WordPress and software development. He had contributed different web application projects in his professional career. Rusen had graduated from Istanbul University, department of Computer Engineering. Rusen has a very high passion for learning and writing for every kind of technology. That's why he has been working as a tech editor for more than ten years on several different technology magazines and online news portals.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

Next Post
Adapting to remote working is not easy as it sounds

Adapting to remote working is not easy as it sounds

Related News

Learn how to install GE-Proton on Steam Play using the ProtonUp-Qt app

How to install GE-Proton on Steam Play using the ProtonUp-Qt app

March 14, 2023 3:15 pm
How to create a song with AIVA for free

How to create a song with AIVA for free?

March 13, 2023 5:50 pm
DALL-E guide how to get the best use out of AI

DALL-E guide: How to get the best use out of AI

March 11, 2023 3:00 pm
How to find the page ID in WordPress

How to find the page ID in WordPress

March 5, 2023 8:00 pm
Get free daily newsletters from Cloud7 News Get the Cloud7 Newsletter
Select list(s):

Check your inbox or spam folder to confirm your subscription.

By subscribing, you agree to our
Copyright Policy and Privacy Policy

Get the free newsletter

Subscribe to receive the latest IT business updates straight to your inbox.

Select list(s):

Check your inbox or spam folder to confirm your subscription.

Recent News

  • 7 best cyber security schools
  • 7 oldest Linux distros that are still being maintained
  • OVHcloud purchases its first Quandela quantum computer
  • Leil Storage launches an innovative data storage solution
  • Tails 5.11 is released, download it now

Cloud7 News
Cloud7 is a news source that publishes the latest news, reviews, comparisons, opinions, and exclusive interviews to help tech users of high-experience levels in the IT industry.

EXPLORE

  • Web Hosting
  • Cloud Computing
  • Data Center
  • Cybersecurity
  • Linux
  • Network/Internet
  • Software
  • Hardware
  • Artificial Intelligence
  • How-Tos
  • Troubleshooting

RESOURCES

  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Podcasts
  • Web Hosting Directory

Get the Cloud7 Newsletter

Get FREE daily newsletters from Cloud7 delivering the latest news and reviews.

  • About Us
  • Privacy & Policy
  • Copyright Policy
  • Contact

© 2023, Cloud7 News. All rights reserved.

No Result
View All Result
  • Cloud Computing
  • Web Hosting
  • Data Center
  • Linux
  • Cybersecurity
  • More
    • Software
    • Network/Internet
    • Hardware
    • Artificial Intelligence
    • Windows
    • Policy/Legislation
    • Blockchain
    • Troubleshooting
    • How-Tos
    • Articles
  • Events
  • Interviews
  • Jobs
  • Opinion
  • Whitepapers
  • Podcasts
  • Web Hosting Directory

© 2023, Cloud7 News. All rights reserved.

Welcome Back!

Sign In with Facebook
Sign In with Google
Sign In with Linked In
OR

Login to your account below

Forgotten Password? Sign Up

Create New Account!

Sign Up with Facebook
Sign Up with Google
Sign Up with Linked In
OR

Fill the forms below to register

*By registering into our website, you agree to the Terms & Conditions and Privacy Policy.
All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.