EDITS.WS

Tag: wordpress security

  • How to Reduce Time to First Byte (TTFB) in WordPress – Expert Tips

    Do you want to improve your WordPress website’s performance and reduce time to first byte (TTFB)?

    When optimizing a WordPress site’s load time, many people overlook the server side. Reducing TTFB (Time To First Byte) will help speed up your site and provide a better user experience.

    In this article, we will show you how to reduce TTFB in WordPress.

    How to reduce TTFB in WordPress step by step

    To help you navigate this post, simply click the links below to jump ahead to your preferred section:

    What is Time to First Byte (TTFB)?

    TTFB, or time to first byte, is the time a server takes to respond to a request and load a web page in the user’s browser.

    In simpler terms, TTFB measures the time between a user clicking on a web page and the browser first starts receiving a response from the website server.

    The longer it takes for a server to send the first byte of data, the longer it takes a browser to display your website. Several factors go into calculating TTFB. For instance, it takes into account DNS lookup, TLS handshake, SSL connection, and more.

    That said, let’s see why it is important to reduce TTFB.

    Why Reduce TTFB in WordPress?

    Time to first byte is one of the factors that can impact the overall speed of your WordPress site, and it is an important metric to keep an eye on.

    TTFB tells the responsiveness of your site’s server, and reducing it will help you provide a better user experience. Your visitors won’t have to wait for web pages to load. In return, it will help boost your conversion, get more leads, and generate sales.

    According to research, a 1 second delay in page load time can lead to a 7% drop in conversions, a 16% decrease in customer satisfaction, and an 11% loss in page views.

    Strangeloop speed study

    Besides that, improving the TTFB score can also boost your WordPress SEO.

    Google uses what it calls Core Web Vitals to measure performance and overall user experience on a website.

    TTFB is not a Core Web Vitals metric, but it can be used for diagnosis purposes. Since it measures how fast a web server responds, you can use TTFB to figure out if something is wrong and impacting the overall Core Web Vitals of your website.

    That said, let’s look at different ways to measure time to first byte.

    How to Check TTFB on Your Website

    You can use different tools and software to check the time to first byte (TTFB) of your WordPress website.

    Measure TTFB Using Google PageSpeed Insights

    Google PageSpeed Insights is a free tool by Google that analyzes your page speed on mobile and desktop. It gives an overall rating out of 100 and measures Core Web Vitals along with other metrics, including time to first byte.

    First, you’ll need to visit the Google PageSpeed Insights website and enter your website URL. After that, simply click the ‘Analyze’ button.

    Google Pagespeed insights

    The tool will then analyze your website and show results.

    You can then view the time to first byte (TTFB) score and other metrics.

    View time to first byte score

    Measure TTFB Using Google Chrome

    You can also use your Google Chrome’s developer tools to view the time to first byte.

    First, you can right-click on your webpage and go to the ‘Inspect’ option. Alternatively, you can also press Ctrl + Shift + I for Windows or Cmd + Opt + I for Mac on your keyboard to open inspect element tools.

    The Google Chrome Inspect tool

    Next, you can switch to the ‘Network’ tab.

    After that, simply hover your mouse over the green bars under the Waterfall column.

    Hover mouse over waterfall

    You now see a popup with different metrics.

    Go ahead and note the ‘Waiting for server response’ time, as this will show you the TTFB for your website.

    View waiting time for server response

    Measure TTFB Using GTmetrix

    Another way to measure the TTFB of your WordPress site is by using GTmetrix. It is a free tool that also measures your site speed.

    Simply visit the GTmetrix website and enter your site URL. After that, go ahead and click the ‘Analyze’ button.

    GTmetrix Test Without a Plugin

    It will take a few minutes for the tool to analyze your site and show the results.

    Next, you can switch to the ‘Waterfall’ tab to view the response time for your web page resources and elements. GTmetrix will show TTFB as ‘Waiting’ in the data.

    View waiting time in GTmetrix

    Expert Tips to Reduce TTFB in WordPress

    Now that you know how to measure TTFB, the next step is to lower it and improve the site’s performance.

    Let’s look at different steps you can take to reduce time to first byte on your WordPress website.

    1. Ensure WordPress, Plugins, and Themes Are Up to Date

    When you’re optimizing your site for TTFB and improving overall performance, the easiest thing to do is make sure that you’re running the latest version of WordPress.

    Each new WordPress version comes with performance improvements. This could mean optimizing the queries that run code in the database, resolving bugs that would slow down your site, and boosting the overall efficiency of your site.

    You can learn more by following our guide on how to safely update WordPress.

    Updating WordPress Core From the Dashboard

    Similarly, you should also ensure that WordPress plugins and themes are up to date. Just like WordPress, newer versions of plugins and themes can include performance optimization that can speed up your site.

    Plus, you should also check if a plugin or theme is slowing down your website and increasing TTFB. You can measure TTFB and run a website speed test by first activating the plugin and then deactivating it to rule out any issues.

    If you’re running older versions of plugins and themes and not sure how to update them, then please see our guide on how to properly update WordPress plugins and how to update WordPress themes without losing customization.

    2. Update Your WordPress Site’s PHP Version

    Updating the PHP version can also significantly improve your site’s performance and lower the time to first byte.

    PHP is an open-source programming language on which WordPress is written. Each new version of PHP improves performance by making processes more efficient and reducing memory usage. This reduces the load on your website server when loading web pages.

    Getting the PHP version on your WordPress website

    Updating the PHP version also helps strengthen your WordPress security. It prevents hackers from exploiting an older PHP version and accessing your website.

    You can follow our complete guide on how to update the PHP version in WordPress to learn more.

    3. Use a Caching WordPress Plugin

    Another simple way to reduce time to the first byte (TTFB) is by using a caching plugin for WordPress.

    Caching stores a temporary copy of your web page after the first load that can be accessed quickly upon request. This speeds up the process, as WordPress won’t have to go through all the steps of generating a page. It also lowers server response time and lowers TTFB.

    Most WordPress hosting providers offer caching with their hosting plans. However, you can also use standalone caching plugins for WordPress.

    For instance, WP Rocket is one of the best caching plugins that is beginner-friendly to use. It automatically optimizes your site to improve performance and offers features like lazy image loading, DNS pre-fetching, and more.

    You can also see our guide to improve WordPress speed and performance for more tips.

    4. Add Content Delivery Network (CDN) to WordPress

    Along with a caching plugin, you can also use a content delivery network (CDN) to reduce the TTFB of your WordPress site.

    A CDN is a network of servers that delivers cached content from your websites to a user based on their geographic location.

    Content Delivery Network (CDN)

    This speeds up the process of displaying web pages to users that are located far away from your website server. People won’t have to wait for the page request to travel all the way to the server location. Instead, a CDN will instantly show a cached version of that page.

    You can see our list of the best WordPress CDN services to choose the most suitable option for your business.

    5. Optimize Your WordPress Database

    You can also optimize your database and compress website files to lower the time to first byte and improve performance.

    If your site’s database contains unnecessary information and hasn’t been cleaned in a while, then it can lower TTFB. For instance, trashed posts, post revisions, and spam comments can sit in the database and impact the TTFB.

    You can manually delete these to clear the database or use a WordPress plugin to handle everything for you. To learn more, please see our guide on WordPress database management.

    6. Switch to the Fastest Hosting Service

    Choosing the right hosting provider for your WordPress website is important. A reputable hosting service is optimized for speed and ensures high performance.

    At WPBeginner, we conducted a test to find the fastest hosting service. We used multiple third-party looks like Pingdom, Load Impact (k6), and Bitcatcha to test the performance of each provider.

    The results revealed Hostinger to be the fastest hosting service, followed by DreamHost and WP Engine.

    You can find all the details in our guide on the fastest WordPress hosting performance test.

    FAQs About Time to First Byte (TTFB)

    Here are some common questions our users have asked us about the time to first byte (TTFB).

    What is a good TTFB?

    According to Google Chrome developers, a good TTFB used to be under 0.8 seconds. However, this number depends on the content you have on your page. For instance, a static page would have a lower TTFB compared to a dynamic page.

    What is included in TTFB?

    TTFB measures the time it takes a user’s browser to receive the first byte of data from the website server. It includes multiple things like DNS lookup, TLS handshake, SSL connection, and more.

    How is TTFB measured?

    You can use different third-party tools like GTmetrix or Google PageSpeed Insights to measure TTFB. You can also use the dev tools in Google Chrome to view the ‘Waiting for server response’ time and check TTFB.

    Why is my TTFB so high?

    There can be several reasons for high TTFB. For instance, a slow website server, location of the server, slow DNS response time, content that has a lot of images and videos, and configuration issues can lead to a high TTFB.

    We hope this article helped you learn how to reduce TTFB in WordPress. You may also want to see our guide on how to speed up your WooCommerce store and the most common WordPress errors.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Reduce Time to First Byte (TTFB) in WordPress – Expert Tips first appeared on WPBeginner.

  • Mastering WordPress Page Protection

    Struggling to securely password protect your WordPress site or certain content? Explore effective methods without impacting site performance. We have your solution!

    The post “Mastering WordPress Page Protection” first appeared on WP Mayor.

  • How to Secure Your WordPress Website in 2023 (Detailed Tutorial)

    WordPress has become one of the world’s most popular content management systems (CMS), with over 44% of websites built on it. As with any online platform, security should be at the top of your list of concerns. In this post, we’ll examine WordPress security concerns and provide tips on how to keep your WordPress website safe and secure.

    Let’s dive in.

    Is WordPress Secure?

    WordPress.org

    For the most part, yes. WordPress developers work hard to maintain the security of their platform through patches and updates occurring regularly. However, since WordPress is built on an open-source framework, hackers can analyze how it’s constructed and frequently develop new ways to gain control of WordPress websites. Because of this, WordPress security is crucial. Knowing the risks associated with using WordPress is important to understand better how to secure your website.

    WordPress Security Concerns

    When operating a WordPress website, there are several potential risks to be aware of. One of the biggest concerns is hackers. Because WordPress is so popular, it attracts the attention of nefarious actors who attempt to exploit vulnerabilities like outdated plugins or core files to gain unauthorized access to your site. They can employ methods such as backdoors, launching brute force attacks, pharma attacks, denial of service (DoS) attacks, or cross-site scripting (XSS).

    If left unresolved, there can be serious consequences, such as malware (malicious code designed to steal your site’s visitor information), forwarding your website to a completely different one, adding content you’re unaware of, Google warnings that can hurt your position in the SERPs, or worse, being unable to log in to your website.

    How to Secure Your WordPress Website

    The following section will explore best practices to enhance WordPress security to protect your website against potential threats.

    Subscribe To Our Youtube Channel

    WordPress Security: Choose Good WordPress Hosting

    The first step to take is partnering with a good WordPress hosting company. With so many choices available, it can be difficult to determine how to choose the right host. If you’re a beginner, it’s probably best to opt for a good managed hosting provider, such as SiteGround, that will provide all security updates for WordPress, while also maintaining the server it’s installed on. For those who are more tech-savvy, a cloud hosting provider, such as Cloudways, is an excellent choice.

    SiteGround WordPress hosting

    Either option will give you all the tools you need to ensure your website is safe and secure, including:

    Keep Your WordPress Login Secure

    Another easy thing you can do to boost your WordPress security is to lock down your login credentials. This can be done in several ways, including using a plugin to change the login URL from /wp-admin to something of your choosing. You can also add two-factor authentication (2FA) to your login and limit login attempts, which will help repel bots.

    Google apps login

    Another way to protect your login is by linking it to your Google account using the Google Apps Login for WordPress. Once your login is locked down, you should whitelist your users’ IP addresses. This ensures that only registered users can get in, even if they have managed to figure out your password.

    Use a Suite of WordPress Security Plugins

    Another very useful thing you can do is to install a good security plugin, such as iThemes Security. It will allow you to add 2FA, limit login attempts, schedule backups, and hide your WordPress login.

    ithemes security plugin

    In addition to a WordPress security plugin, consider installing a good backup plugin, like UpdraftPlus, if your host doesn’t offer backups. A backup plugin protects you from losing your site’s files, helping you to avoid rebuilding WordPress from scratch. You can easily restore your site with little effort if something goes wrong. Finally, incorporating an activity log plugin like WP Activity Log will allow you to pinpoint what went wrong and when.

    Keep PHP Updated

    WordPress requires three things to work correctly: PHP, MySQL, and HTTPS support. PHP, or hypertext preprocessor, is a popular open-source scripting language used in web development and is the backbone of WP. Like WordPress, being open source leaves it open for malicious actors looking to take advantage. To avoid these potential issues, it’s best to keep PHP updated. Not only does it help with WordPress security, but it also keeps your site running optimally.

    How PHP works

    Choose Strong Passwords

    One of the most important aspects of WordPress security is choosing strong passwords for login. Weak or easily guessable passwords leave your site vulnerable to unauthorized access and expose your site to botnets. Botnets are a collection of computers that have been infected by malware and come under the control of a hacker. They are the leading cause of DDoS attacks on the internet, but you can prevent your site from falling victim to them by taking the correct precautions.

    Password policy maker plugin

    For example, you can protect your site by ensuring all users adhere to a password policy. One great way to do this is by installing a plugin like Password Policy Maker.

    WordPress Security: Keep Software Updated

    Another simple step in WordPress security is keeping your WordPress core, plugins, and themes updated. Leaving software out of date can have negative consequences on your website, including security breaches, the WordPress white screen of death, or any number of common errors.

    You can either keep up with updates on your own or enable automatic updates. What is right for you depends on several factors, including time, expertise, and the type of software your WordPress install runs. Regardless of whether you handle updates or choose to update automatically, you should always make a backup before performing any updates.

    Install SSL Certificate

    If you partner with a good hosting provider, one of the benefits that come with it is a free SSL certificate. However, there may be situations where you’ll need to install one yourself. Most providers, like SiteGround, offer a free SSL that installs in a few minutes. As you read this, you might ask , “Why do I need an SSL certificate?”. Let’s explain.

    SSL certificate WordPress security

    image courtesy of Valery Brozhinsky | Shutterstock.com

    SSL, or secure socket layer, expands the hypertext transfer protocol (HTTP) to hypertext transfer protocol secure (HTTPS), adding encryption and an extra layer of security. For example, a consumer who makes a purchase over HTTP risks their credit card information being exploited. On the other hand, their information would be protected if they had made the same purchase over HTTPS. Your site and its visitors are exposed and vulnerable without that secure connection. That’s why installing an SSL certificate on any new website is crucial.

    Conduct a Security Audit

    Once you’ve taken steps to secure your site, it’s important to conduct a WordPress security audit occasionally. Just as technology changes daily, so does a hacker’s arsenal of tools. Malware and other tactics are developed regularly, so securing your WordPress website isn’t a one-and-done deal. Schedule regular security checks, and look for signs that your site may be in trouble. If you notice your site loading slowly, your traffic drops, you discover new links you didn’t add, or you experience excessive login attempts, it may be time to run a security scan to ensure your site remains safe and secure.

    Advanced WordPress Security Techniques

    In addition to the steps listed above, there are a few more advanced techniques to incorporate into your site to enhance WordPress security.

    Harden the wp-config.php File

    One common point of entry for hackers is your WordPress website’s wp-config.php file. It houses information about your database, including the name, host, username, and password. Leaving this important file open can prove detrimental, so hiding it is always a good idea.

    Move Your wp-config.php File

    To move wp-config, you can drag it into your site’s root folder (public HTML), and WordPress will look for it whenever the site is pinged. However, if your site’s file structure includes a htaccess file, you can further protect it by adding a directive to deny access to it by using the following code:

    <FilesMatch "wp-config/.php">
    Require all denied
    </FilesMatch">
    

    Note: Before doing this, ensure your hosting provider hasn’t already taken steps to move your wp-config file for you. Some hosts, such as Kinsta, do this automatically to keep your site safe.

    Change WordPress Salt Keys

    WordPress salt keys

    Another way to protect your wp-config file is by altering your site’s salt keys. These keys add an extra layer of protection while saving passwords to your database, signing in to cookies, and other important WordPress security aspects. If hackers can obtain your salt keys, they can access your site’s database and files, including stored credit card information, passwords, and other important information. Therefore, it’s recommended to change them periodically.

    Change File Permissions

    By default, files in your root directory are set to 644, which means they are both readable and writable, leaving them vulnerable to bad actors. According to WordPress, these should not be left at default permissions. Rather, they should be changed to 440 or 400 to prevent others on the same server from reading them. However, it’s important to check with your hosting provider before making any changes to your file permissions. They may have a unique system in place, so changing permissions could cause disruption to your site.

    Disable XML-RPC

    XML-RPC is a WordPress API that allows you to connect your website to third-party apps and tools. In recent years, it has been exploited by brute force attacks, allowing access to WordPress sites. It is primarily used for making Zapier connections or accessing your site remotely through an app. You should disable XML-RPC on your server if you aren’t using any of these connections.

    There are several ways to do this, including disabling it through htaccess, using a code snippet, or with a plugin. The most advanced method, htaccess, can be tricky for beginners, so the most recommended approach is to use a code snippet.

    For the htaccess method, use an FTP client to access your site’s files, then add the following code to your htaccess file:

    # Block WordPress xmlrpc.php requests
    <Files xmlrpc.php>
    order deny, allow
     deny from all
    allow from 123.123.123.123
    </Files>
    

    Note: Be sure to change the IP 123.123.123.123 with your own.

    Alternatively, you can use the AIOSEO plugin’s tools htaccess tab to insert the code:

    AIOSEO

    If you’d rather disable XML-PRC using a code snippet, you can easily accomplish it using the WPCode plugin. It has a built-in snippet that you can use to disable the API.

    disable XML-PRC

    Hide WordPress Version

    This is an often overlooked step when it comes to WordPress security, but an important one. By default, WordPress leaves a footprint in your site’s code that shows which version is installed. This might seem harmless, but by accessing the website’s source code, hackers can determine what version of WordPress you’re running. If it’s outdated, they can use that info to hack into your site by injecting malware or malicious scripts.

    hide WordPress version

    So, as an extra WordPress security measure, hide your site’s WordPress version to make it harder for hackers to take control of your site. There are good ways to do this. You can either implement a code snippet plugin that will remove the line in the source code or create a child theme and place it into your functions.php file.

    function elegantthemes_remove_version() {
    return '';
    }
    add_filter('the_generator', 'elegantthemes_remove_version');
    

    Alternatively, if you’d like to remove the WP version in the meta tag, in database query strings, and in RSS feeds, use this code:

    /* Hide WP version strings from scripts and styles
    * @return {string} $src
    * @filter script_loader_src
    * @filter style_loader_src
    */
    function elegantthemes_remove_wp_version_strings( $src ) {
    global $wp_version;
    parse_str(parse_url($src, PHP_URL_QUERY), $query);
    if ( !empty($query['ver']) && $query['ver'] === $wp_version ) {
    $src = remove_query_arg('ver', $src);
    }
    return $src;
    }
    add_filter( 'script_loader_src', 'elegantthemes_remove_wp_version_strings' );
    add_filter( 'style_loader_src', 'elegantthemes_remove_wp_version_strings' );
     
    /* Hide WP version strings from generator meta tag */
    function wordpress_remove_version() {
    return '';
    }
    add_filter('the_generator', 'elegantthemes_remove_version');
    

    What to Do if Your WordPress Website is Hacked

    Even if you do everything right, you may find yourself in a situation where your website has been hacked. Thankfully, there are steps you can take, including putting your site into recovery mode, restoring from your most recent backup, or resetting your passwords. If all else fails, your hosting provider may be able to help.

    Final Thoughts on WordPress Security

    By taking the necessary steps to boost your WordPress security, you can ensure your site continues to operate normally while being safe for your visitors. While WordPress offers tremendous benefits and ease of use, it’s important to understand its shortcomings. Thankfully, there are a number of WordPress security plugins like iThemes that can help keep things on track.

    Looking for more information on WordPress? Check out some of our in-depth articles that will transform you into a WordPress expert in no time:

    Featured Image via Pikovit / shutterstock.com

    The post How to Secure Your WordPress Website in 2023 (Detailed Tutorial) appeared first on Elegant Themes Blog.

  • What is 414 Request URI Too Long Error and How to Fix It

    Have you ever encountered a 414 request URI too long error on your WordPress website?

    The error is usually caused when there is a critical error between your web browser and a server. You’ll see this error when clicking on a link or any action performed by a WordPress plugin.

    In this article, we will show you what is the ‘414 request URI too long’ error and how to fix it.

    What is 414 request URI too long error and how to fix it

    What is 414 Request URI Too Long Error?

    A 414 request URI too long error occurs when a URL or an action you’re requesting is too long for the server to handle.

    Do note that there is a difference between URI and URL. A URI or Uniform Resource Identifier can be a resource’s name, location, or both. On the other hand, a URL or Uniform Resource Locator can only be the location of a resource.

    Both terms are usually used interchangeably because URL is part of URI. However, the 414 error can be triggered by both components, so let’s look at the causes.

    What Causes 414 Request URI Too Long Error?

    You might see the 414 error when you click on the link, and the server is unable to process it because it’s too long.

    One situation where a link might to very long is using UTM (Urchin Tracking Module) parameters. If you’re using UTM codes to track conversions on your WordPress website and there are a lot of parameters in the URL, then it can cause this error.

    Another situation that can cause a 414 error is a redirect loop. This is when a misconfiguration or a setting in a WordPress plugin causes a lot of redirect requests.

    As a result, you get incredibly long URLs and 414 requests URI too long error.

    Similarly, some plugins can also generate lengthy URIs as part of their functionality. You’re most likely to encounter this error if you have all-in-one WordPress security plugins installed on your site.

    In a rare event, a developer-side issue can also trigger a 414 error when a POST request converts into a GET request with query information being too long. Lastly, cyber attacks on your website server can also result in 414 URI too long issues.

    That said, let’s see how you can fix the 414 error on your WordPress website.

    Fixing 414 Request URI Too Long Error

    A quick way to fix this issue is by increasing the size of the URI your website server can process.

    Before we move forward, we recommend creating a WordPress backup. That’s because fixing the 414 error involves editing the website configuration files. In case anything goes wrong, you’ll have a backup copy of your site ready to restore.

    For more details, please see our guide on how to backup a WordPress site.

    Determine if Your Website is Using Apache or Nginx

    First, you’ll need to find out the type of server your WordPress website is using. There are 2 main types of servers, which includes Apache and Nginx.

    A simple way to do that is by opening your site in a browser. After that, you can right-click on the homepage and select the ‘Inspect’ option.

    Open inspect element

    Next, you’ll need to switch to the ‘Network’ tab at the top.

    From here, you can select any element under the Name column. After that, you will need to scroll down to the ‘Response Headers’ section and see the ‘Server’ details.

    View server type of your site

    This will show you whether your site is using Nginx or Apache.

    If you’re still unsure which server type to use, then you can reach out to your WordPress hosting provider to get more details.

    Once you’ve determined the server type, let’s look at how to fix the 414 request URI too long error for Apache and Nginx.

    Fixing 414 Request URI Too Long Error in Nginx

    First, you’ll need an FTP or file transfer protocol client to access website configuration files.

    There are many FTP clients you can use. For this tutorial, we will use Filezilla. If you need help setting up FTP and accessing website files, then please see our guide on how to use FTP to upload files to WordPress.

    Once you’re logged in, you’ll need to download the ‘nginx.conf’ file. You can access this by following this path: /etc/nginx/nginx.conf

    Access Nginx file

    After locating the file, go ahead and download it on your computer and then open it in a notepad software.

    From here, you can search for large_client_header_buffers 4 8K settings. If it’s not there, then simply add it to the end of the file.

    You will see 2 sets of values, which relate to a number and size. Simply edit the size from 8K to 128K. This will increase the URI size and allow the site server to process long URLs.

    Increase URI size in Nginx

    Once you’re done, simply save the text file and reupload it to your website using the FTP client.

    For more details, please see our guide on how to use FTP to upload files to WordPress.

    Fixing 414 Request URI Too Long Error in Apache

    If you’re using the Apache server type, then the process is similar to that of Nginx. First, you’ll need an FTP client to access website files.

    Once you’re logged in, you’ll need to locate the ‘apache2.conf’ file. Simply head to the following path using the FTP client: /etc/apache2/apache2.conf

    Access apache config files

    Next, you’ll need to download the file and open it in notepad software.

    After that, you can look for LimitRequestLine 128000 settings. If you don’t see one, then simply add it to the end of the file.

    Usually, LimitRequestLine is set to 128000. However, you can increase this to 256000 or higher to remove the 414 error. Just make sure that the value you set is a multiple of 2.

    Increase URI size in apache

    Once you’re done, simply upload the file back to the website using the FTP client. This should help resolve the 414 error on your WordPress website.

    We hope this article helped you learn about what is 414 request URI too long error and how to fix it. You may also want to see our guide on WordPress security and the most common WordPress errors.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post What is 414 Request URI Too Long Error and How to Fix It first appeared on WPBeginner.

  • How to Add HTTP Security Headers in WordPress (Beginner’s Guide)

    Do you want to add HTTP security headers in WordPress?

    HTTP security headers allow you to add an extra layer of security to your WordPress website. They can help block common malicious activity from affecting your site’s performance.

    In this beginner’s guide, we will show you how to add HTTP security headers in WordPress.

    How to Add HTTP Security Headers in WordPress (Beginner's Guide)

    What Are HTTP Security Headers?

    HTTP security headers are a security measure that allows your website’s server to prevent some common security threats before they can affect your website.

    When a user visits your WordPress website, your web server sends an HTTP header response to their browser. This response tells browsers about error codes, cache control, and other statuses.

    The normal header response issues a status called HTTP 200. After this, your website loads in the user’s browser. However, if your website is having difficulty, then your web server may send a different HTTP header.

    For example, it may send a 500 internal server error or a not found 404 error code.

    HTTP security headers are a subset of these headers. They are used to protect websites from common threats like click-jacking, cross-site scripting, brute force attacks, and more.

    Let’s have a quick look at some HTTP security headers and how they protect your website:

    • HTTP Strict Transport Security (HSTS) tells web browsers that your website uses HTTPS and should not be loaded using an insecure protocol like HTTP.
    • X-XSS Protection allows you to block cross-site scripting from loading.
    • X-Frame-Options prevents cross-domain iframes or click-jacking.
    • X-Content-Type-Options X-Content-Type-Options blocks content mime-type sniffing.

    HTTP security headers work best when they are set at the web server level, which means your WordPress hosting account. This allows them to be triggered early on during a typical HTTP request and provide maximum benefit.

    They work even better if you are using a DNS-level website application firewall like Sucuri or Cloudflare.

    That being said, let’s take a look at how to easily add HTTP security headers in WordPress. Here are quick links to different methods so that you can jump to the one that suits you:

    1. Adding HTTP Security Headers in WordPress Using Sucuri

    Sucuri is one of the best WordPress security plugins on the market. If you are using their website firewall service, then you can set HTTP security headers without writing any code.

    First, you will need to sign up for a Sucuri account. It is a paid service that comes with a server-level website firewall, security plugin, CDN, and malware removal guarantee.

    During sign-up, you will need to answer simple questions, and Sucuri documentation will help you set up the website application firewall on your website.

    After signing up, you must install and activate the free Sucuri plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.

    Upon activation, you need to go to Sucuri Security » Firewall (WAF) and enter your Firewall API key. You can find this information under your account on the Sucuri website.

    Sucuri WAF API key

    After that, you will need to click the green ‘Save’ button to store your changes.

    Next, you must switch to your Sucuri account dashboard. From here, click on the ‘Settings’ menu on top and then switch to the ‘Security’ tab.

    Setting HTTP security headers in Sucuri

    From here, you can choose three sets of rules. The default protection will work well for most websites.

    If you have a Professional or Business plan, then you also have options for HSTS and HSTS Full. You can see which HTTP security headers will be applied for each set of rules.

    You need to click the ‘Save Changes in the Additional Headers’ button to apply your changes.

    Sucuri will now add your selected HTTP security headers in WordPress. Since it is a DNS-level WAF, your website traffic is protected from hackers even before they reach your website.

    2. Adding HTTP Security Headers in WordPress Using Cloudflare

    Cloudflare offers a basic free website firewall and CDN service. It lacks advanced security features in its free plan, so you will need to upgrade to its Pro plan, which is more expensive.

    You can learn how to add Cloudflare to your website by following our tutorial on how to set up the Cloudflare free CDN in WordPress.

    Once Cloudflare is active on your website, you must go to the SSL/TLS page in your Cloudflare account dashboard and then switch to the ‘Edge Certificates’ tab.

    Setting up HTTPS security headers in Cloudflare

    Now, scroll down to the ‘HTTP Strict Transport Security (HSTS)’ section.

    Once you find it, you need to click on the ‘Enable HSTS’ button.

    Click the Enable HSTS Button

    This will bring up a popup with instructions telling you that you must have HTTPS enabled on your website before using this feature.

    If your WordPress blog already has a secure HTTPS connection, then you can click on the ‘Next’ button to continue. You will see the options to add HTTP security headers.

    Enable HTTPS security headers in Cloudflare

    From here, you can enable HSTS, apply HSTS to subdomains (if the subdomains are using HTTPS), preload HSTS, and enable no-sniff header.

    This method provides basic protection using HTTP security headers. However, it does not let you add X-Frame-Options, and Cloudflare doesn’t have a user interface to do that.

    You can still do that by creating a script using the Cloudflare Workers feature. However, we don’t recommend this because creating an HTTPS security header script may cause unexpected issues for beginners.

    3. Adding HTTP Security Headers in WordPress Using .htaccess

    This method allows you to set the HTTP security headers in WordPress at the server level.

    It requires editing the .htaccess file on your website. This server configuration file is used by the most commonly used Apache webserver software.

    Note: Before making any changes to files on your website, we recommend making a backup.

    Next, simply connect to your website using an FTP client or the file manager in your hosting control panel. In the root folder of your website, you need to find the .htaccess file and edit it.

    View of Edit the .htaccess File Using an FTP Client

    This will open the file in a plain text editor. At the bottom of the file, you can add some code to add HTTPS security headers to your WordPress website.

    You can use the following sample code as a starting point. It sets the most commonly used HTTP security headers with optimal settings:

    <ifModule mod_headers.c>
    Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Content-Type-Options nosniff
    Header set X-Frame-Options DENY
    Header set Referrer-Policy: no-referrer-when-downgrade
    </ifModule>
    

    Don’t forget to save your changes and visit your website to make sure that everything is working as expected.

    Note: Take care when editing code on your website. Incorrect headers or conflicts in the .htaccess file may trigger the 500 Internal Server Error.

    4. Adding HTTP Security Headers in WordPress Using AIOSEO

    All in One SEO (AIOSEO) is the best SEO tool for WordPress and is trusted by over 3 million businesses. The premium plugin lets you easily add HTTP security headers to your website.

    The first thing you will need to do is install and activate the AIOSEO plugin on your website. You can learn more in our step-by-step guide on how to set up All in One SEO for WordPress.

    You then need to head over to the All in One SEO » Redirects page to add the HTTP security headers. First, you will need to click the ‘Activate Redirects’ button to enable the feature.

    Activating Redirects in All in One SEO

    Once redirects are enabled, you need to click on the ‘Full Site Redirect’ tab and then scroll down to the ‘Canonical Settings’ section.

    Simply enable the ‘Canonical Settings’ toggle and then click the ‘Add Security Presets’ button.

    Add Security Presets in AIOSEO

    You will see a preset list of HTTP security headers appear in the table.

    These headers are optimized for security. You can review and change them if needed.

    Security Headers are Added in AIOSEO

    Make sure to click the ‘Save Changes’ button at the top or bottom of the screen to store the security headers.

    You can now visit your website to make sure that everything is working fine.

    How to Check HTTP Security Headers for a Website

    Now that you have added HTTP Security headers to your website, you can test your configuration using the free Security Headers tool.

    Simply enter your website URL and click on the ‘Scan’ button.

    Checking a Website's HTTP Security Headers

    It will then check HTTP security headers for your website and show you a report. The tool will also generate a so-called grade label, which you can ignore as most websites will get a B or C score without affecting user experience.

    It will show you which HTTP security headers are sent by your website and which ones are not included. If the security headers that you wanted to set up are listed there, then you are done.

    We hope this article helped you learn how to add HTTP security headers in WordPress. You may also want to see our complete WordPress security guide and our expert picks for the best WordPress plugins for business websites.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Add HTTP Security Headers in WordPress (Beginner’s Guide) first appeared on WPBeginner.

  • 9 Things to Do if Your WordPress Site Keeps Going Down

    Are you wondering what to do if your WordPress site keeps going down?

    A website that is down (offline) can hurt your business. It creates a bad user experience for visitors who cannot access your content, and you may even lose customers and potential sales.

    In this article, we will share the most important things you need to do if your WordPress website keeps going down.

    Things to do if your WordPress website keeps going down

    Why Does Your WordPress Website Keep Going Down?

    When your WordPress website is down, your users will see an error message that prevents them from visiting the page.

    If your website is down due to one of the common WordPress errors, then you can simply fix it to resolve the issue.

    However, if the issue keeps happening, or your website is not showing an error, then you will need to investigate it further.

    Website downtime can happen for several reasons, including unreliable hosting, an expired domain, security reasons, an error in custom code, and more.

    Another reason for downtime can be increased website traffic that exceeds your WordPress hosting resource limits.

    No matter the reason, if your WordPress website keeps going down on a regular basis, then it can harm your business. Your conversion rates may fall, and you might lose customers.

    Luckily, we have compiled a list of things to do if your WordPress website keeps going down. These steps will help you troubleshoot the cause and fix it easily.

    1. Check if It Is Just You or if the Website Is Down for Everyone

    Your WordPress website may not be down for everyone. Sometimes you might just be unable to access your site due to a network error or lack of internet connection.

    First, you will need to verify that your website is down for everyone and not just you.

    To do that, you can use IsItWP’s free uptime checker.

    First, visit the Website Uptime Status Checker website and enter your site URL.

    IsItWP Uptime Checker Tool

    Click on the ‘Analyze Website’ button, and the tool will tell you if your website is down for everyone or just you.

    If it is only down for you, then we recommend checking your internet connection. You can try clearing your browser cache or restarting your network router.

    On the other hand, if your website is down for everyone, then continue reading to learn how to fix it.

    2. Make Sure Your WordPress Hosting Plan Has Not Expired

    One of the most common reasons for website downtime is your WordPress hosting provider. Your plan may have expired, or the provider might be having server problems.

    First, you need to make sure that your hosting plan hasn’t expired. You can usually find this information in your hosting account dashboard.

    If your plan has not expired, but your WordPress website keeps going down, then you will need to contact your hosting provider. It is possible that they are facing an issue on their end and can provide you with more information about it.

    For example, your hosting company might be performing server maintenance, facing DDoS attacks, or may have taken down a few servers. All of these reasons could result in downtime.

    Your website may also be down due to the failure of some hardware components of the host’s server.

    In these cases, your website should be up and running again once the hosting provider fixes the issues.

    If you’re constantly running into issues with your hosting provider, then it’s a good idea to switch to a more reliable managed WordPress hosting company.

    We recommend going with either SiteGround, Hostinger, or WP Engine.

    3. Make Sure Your Domain Has Not Expired

    Sometimes the website goes down because the domain name you bought when starting your website might have expired. If this is the case, it needs to be renewed.

    To check if your domain is still valid, you can use a WHOIS lookup tool. You just need to enter your domain name and click the ‘Lookup’ button.

    The tool will then look up details of your domain name. If your domain has expired, it might show as available for registration.

    Domain available for registration

    If your domain has expired, then you can now go ahead and renew it using any domain registrar, such as Domain.com.

    You can also obtain a free domain from some hosting providers, including Hostinger. This is a top WordPress hosting company that provides a free domain name with any web hosting plan.

    You can also use our Bluehost coupon code, which provides WPBeginner users with a free domain name, SSL certificate, and a discount on web hosting plans.

    4. Check Your Plugins and Themes

    WordPress plugins or themes can sometimes cause website downtime. The software may be outdated and / or have a vulnerability that hackers can use to take down your site.

    Similarly, a WordPress theme can conflict with a particular WordPress version or a plugin on your website.

    To see if a plugin or theme is causing downtime, you will need to deactivate all of your plugins and switch to a default theme.

    Deactivate All WordPress Plugins

    Deactivating all of your WordPress plugins can quickly show you if one of the tools is causing your site’s downtime.

    If you have access to the WordPress admin area, then you need to visit the Plugins » Installed Plugins page from the admin sidebar.

    From here, you can select all plugins by simply checking the bulk select checkbox at the top.

    Check the box next to the Plugins option

    Next, open the ‘Bulk actions’ dropdown menu and select the ‘Deactivate’ option.

    After that, click on the ‘Apply’ button to deactivate all of the plugins.

    Choose the deactivate option from the Bulk Options dropdown menu

    However, if you don’t have access to the WordPress admin, then you can deactivate plugins using a File Transfer Protocol (FTP) client.

    First, you need to connect to your website using an FTP client or the File Manager app in your hosting account control panel. Once your site is connected, head to the /wp-content/ folder.

    Inside, you should see a folder named ‘plugins.’ This is where all your WordPress plugin files are stored.

    Rename plugins folder

    Simply rename the plugins folder to ‘plugins_deactivate.’ This will deactivate all WordPress plugins installed on your website.

    For more detailed instructions, please see our tutorial on how to deactivate WordPress plugins when not able to access WP-Admin.

    Switch to a Default WordPress Theme

    Your WordPress theme may also cause your website to malfunction. This can happen if you are using a poorly coded or outdated WordPress theme that has not been updated for a while.

    To find out if your current WordPress theme is causing downtime, you will need to switch to a default WordPress theme.

    First, connect to your website using an FTP client or the File Manager app in your hosting account control panel.

    After that, go to the /wp-content/themes/ folder.

    From here, you need to locate the ‘themes’ folder. This is where all the themes from your WordPress website are stored.

    Simply rename the folder to ‘themes_deactivate’ to deactivate your current theme.

    Rename themes folder

    Next, you need to create a new folder named ‘themes.’

    After that, you can go ahead and download a default WordPress theme like Twenty Twenty-Three from the WordPress themes directory.

    Downlaod default theme to your computer

    Once it has been downloaded, you need to unzip the file.

    Next, simply upload the downloaded theme file in the new ‘themes’ folder. This will activate it on your WordPress website.

    Upload theme folder

    You can also delete themes using the WordPress database. For more instructions, you can see our guide on how to delete a WordPress theme.

    If changing the theme or deactivating plugins didn’t resolve the issue, then continue reading.

    5. Check Your WordPress Settings

    Your website may also experience downtime due to incorrect WordPress configuration settings. Most commonly, your site may be using the wrong WordPress address.

    First, you will need to check if your WordPress address and site address are the same.

    The WordPress address is where your WordPress files and folders are stored. By contrast, the site address points to the part of your website that visitors see and interact with.

    If you have access to the WordPress admin dashboard, then just visit the Settings » General page from the admin sidebar.

    From here, make sure that the ‘WordPress Address’ and ‘Site Address’ boxes have the same URL.

    Check your WordPress and site address from the WordPress admin

    However, if you don’t have access to the WordPress admin, then you can check your site URLs by editing the wp-config.php file.

    For more detailed instructions, you can check out our tutorial on how to change your WordPress site URLs.

    Permalinks are the permanent URLs for posts and pages on your website.

    Your permalinks can break due to installing or updating a particular theme or plugin. Additionally, migrating your website to a new server or domain can also break your permalinks and cause your site to go down.

    In this case, you can regenerate your site’s permalinks by going to Settings » Permalinks from the admin sidebar. Here, make sure that you have the right permalink structure selected.

    Next, you simply need to click on the ‘Save Changes’ button at the bottom to repair the broken permalinks.

    Check Permalinks

    If this method doesn’t work, we recommend checking out our tutorial on how to regenerate permalinks in WordPress for other solutions.

    If your website is still down after repairing its permalinks, then you will need to continue reading.

    7. Try Reuploading the WordPress Core Files

    Updating the core WordPress software can also cause downtime due to changes or corruption of the core files. When this happens, important system files for your website cannot be accessed.

    To fix this problem, you can try reuploading the /wp-admin/ and /wp-includes/ folders from a fresh WordPress install.

    Note: This method will not remove any information or content from your site, but it may fix a corrupted core file.

    First, you’ll need to visit the WordPress.org website and click the ‘Download & Extend’ menu link, followed by ‘Get WordPress’. Next, click the blue ‘Download WordPress’ button to download the .zip folder to your computer.

    How to download WordPress

    Next, you’ll need to extract the zip file and find the ‘wordpress’ folder inside of it.

    After that, connect to your website using an FTP client. Once you have made the connection, head to the root folder of your website. It is typically called ‘public_html’ and it contains the wp-admin, wp-includes, and wp-content folders, along with other files.

    Open the WordPress folder on your computer in the left column. Then, select all of its files and hit ‘Upload’ to transfer them to your website.

    Upload core WordPress files

    The FTP client will now transfer these folders to your server.

    Next, it will ask if you would like to overwrite the files. You need to simply check the ‘Overwrite’ option and then select ‘Always use this action.’

    Overwrite WordPress core files

    Finally, hit the ‘OK’ button. Your older WordPress files will now be replaced with fresh copies.

    If replacing corrupted files doesn’t solve the problem, then you need to move to the next step.

    8. Install a Firewall on Your Website

    Your WordPress website might also be down due to malware or DDoS attacks.

    During a DDoS attack, a hacker sends a large amount of data requests to your WordPress hosting server. This causes the server to slow down and eventually crash.

    Similarly, malware is software that injects itself into your WordPress files. It uses up your WordPress server resources by attacking other websites or generating spam.

    Luckily, you can easily prevent DDoS attacks and malware by using a web application firewall.

    The firewall acts as an filter between your website and incoming traffic. It identifies and blocks all suspicious requests before they reach your server.

    We recommend using Sucuri because it is the best WordPress security plugin with a website firewall.

    It runs on a DNS level and catches DDoS attacks before they can even make a request to your website.

    Sucuri Website Application Firewall

    However, if you are looking for a free solution, then we recommend using Cloudflare instead.

    You may want to read our article on Sucuri vs Cloudflare for a detailed comparison.

    For better website protection, you will also need to use security best practices on your WordPress website. For more details, see our complete WordPress security guide with step-by-step instructions on how to secure your site.

    9. Move to a Reliable WordPress Hosting Plan

    Finally, if you have tried all the steps above and your website keeps going down, then it might be time to move to a reliable WordPress hosting provider.

    If you have a small business or blog, then we recommend moving to Bluehost or Hostinger.

    If you run an online store, then SiteGround is the go-to hosting provider because it comes with a managed EDD hosting plan. This enables you to launch a ready-to-go eCommerce store.

    Alternatively, if you have a rapidly growing business, then you should consider switching to a managed WordPress hosting provider like WP Engine.

    Once you have chosen a provider, you will need to move your website to the new host.

    Most hosting companies offer a free migration service that allows you to migrate your website without downtime.

    You can also move your website on your own. For detailed instructions, you may want to see our tutorial on how to move WordPress to a new host or server.

    We hope this article helped you learn what to do if your WordPress website keeps going down. You may also want to see our article on the best email marketing services compared and our tutorial on how to get a free SSL certificate for your website.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post 9 Things to Do if Your WordPress Site Keeps Going Down first appeared on WPBeginner.

  • Should I Give Permission for WordPress Plugins to Collect Data?

    One of our readers recently asked whether it’s ok to give WordPress plugins on your site permission to collect usage data.

    They were concerned about whether there are security concerns in sharing website usage data with plugin developers, and whether there are any benefits for doing so.

    In this article, we’ll discuss the pros and cons of letting plugins collect data from your WordPress site, and when it poses an unacceptable security risk.

    Should I Give Permission for Plugins to Collect Data From My Site?

    Which WordPress Plugins Collect Data From Your Website?

    Most plugins DO NOT collect any data from your WordPress website. However, some plugins may ask you to share anonymous usage data with the developers, so that the plugin can be improved.

    For example, on the WPForms plugin’s Miscellaneous Settings page, you will find an option called ‘Allow Usage Tracking.’

    Some Plugins Ask You to Allow Usage Tracking

    The description explains, ‘By allowing us to track usage data, we can better help you, as we will know which WordPress configurations, themes, and plugins we should test.’

    Similar to leaving plugin reviews, sharing anonymized data with reputable plugins is a helpful way to support plugin developers.

    WordPress.org rules require that all free plugins MUST get user’s consent before enabling such usage tracking, so you can be certain that no one will collect your website’s data unless you specifically authorize them to do so.

    Now you may be interested to learn about the types of usage data that help plugin developers.

    How Do We Use Usage Data Collected by Our Plugins?

    It may be helpful to give you our perspective, and let you know about the types of data we collect from our plugins, as well as how we use the data to improve our products.

    Awesome Motive, the company behind WPBeginner, develops a suite of free and premium WordPress plugins that are used by over 25 million websites.

    Our plugins include OptinMonster, MonsterInsights, WPForms, SeedProd, WP Mail SMTP, RafflePress, All in One SEO, Smash Balloon, and many more.

    Some of our plugins give you the option to enable anonymous usage tracking. This helps us to improve each plugin and make better decisions about future feature development.

    The data we collect is always anonymous. It is not tied to your website in any way. For example, here is a screenshot from the OptinMonster Miscellaneous settings page.

    OptinMonster Asks You to Share Anonymous Usage Tracking

    You can think of the data we collect as telemetry. It allows us to monitor how our plugin is being used in real-time.

    It is important to understand that we are looking for how our plugins are being used across our entire user base, not on your particular website.

    That means we will never know which settings and plugins are being run on a specific website such as syedbalkhi.com. But we will be able to discover, for example, the percentage of all users who have installed a specific version of our plugin.

    We also find it useful to collect information about the server environment being used by your WordPress hosting provider, including your PHP version, MySQL version, and locale / language.

    This allows us to test our plugins for the most popular versions among our users. It also allows us to improve coding standards by safely deprecating older versions.

    For instance, the diagram below shows the different versions of PHP being used by one of our plugins’ users. It shows that PHP 5.5 is used by very few users, and this helps us to decide whether to deprecate support for that version of PHP.

    The Data We Collect Lets Us Make Decisions About Which Versions of PHP to Support

    We’re also interested in which plugin features are being used and which settings are active. This information gives us a better idea of which features are doing well, and which aren’t.

    Besides that, we gather aggregated data to improve our cross-plugin and theme compatibility to ensure that our plugin updates does not lead to any conflict with other popular plugins that happens so often in the WordPress industry.

    Again, this is all general, aggregated data and not tied in any way to you and your specific website.

    We NEVER collect any data about your website’s visitors, customers, or any other personal identifiable information.

    Should You Allow WordPress Plugins to Collect Data From Your Site?

    Now that you can see the benefits sharing usage data gives to the plugin developer, we’ll answer the question of whether you should allow plugins to collect data from your WordPress site. This decision needs to happen on a case-by-case basis. Here are some guidelines.

    Anonymous Usage Tracking

    When a reputable plugin collects data from your website anonymously, then it is normally safe to share usage data with the developer.

    You can look for the author’s reputation. If the plugin is popular, then you can be confident they will collect and use the data responsibly. You could even reach out to them and ask how they use the data they collect.

    Also, if you rely on the plugin to add needed features to your website, then you can help the developer to improve the plugin and add features by sharing anonymous usage data.

    Data Tied to Your Website or Email Address

    However, not all data is collected anonymously. For example, there may be plugins that tie your usage activity to your specific website or even an individual email address.

    In these cases, you should exercise caution. It is normally not a good idea to freely share such detailed information about your website with third parties.

    You can learn more by reading our guide on WordPress security best practices.

    Nulled or Pirated Plugins

    Also, if you want to keep your website secure, then you should never use nulled themes and plugins, or pirated copies of premium WordPress products.

    That’s because you have no way of knowing how they have been modified. They might collect sensitive information about your website without your permission. They may even spread malware to your users or give hackers access to your site.

    Nulled and pirated plugins pose a serious security risk. That’s why we recommend that you do not ever allow data collection from a nulled or pirated plugin or theme. For more details, see our guide on why you must avoid nulled WordPress themes and plugins.

    We hope this tutorial helped you learn whether you should give permission for plugins to collect data from your site. You may also want to learn how to speed up your WordPress performance, or our expert pick of must-have WordPress plugins for business sites.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post Should I Give Permission for WordPress Plugins to Collect Data? first appeared on WPBeginner.

  • How to Password Protect Your WordPress Admin (wp-admin) Directory

    Do you want to learn how to password-protect your WordPress admin directory?

    Adding another layer of password protection to your WordPress admin directory can be a great way to improve your WordPress security.

    In this article, you’ll learn how you can password-protect your wp-admin directory easily.

    How to Password Protect Your WordPress Admin (wp-admin) Directory

    Why Password Protect Your WordPress Admin Directory?

    By password-protecting your WordPress admin directory, you improve the security of the most important entry point to your WordPress website.

    Your WordPress admin dashboard is the central hub of your site. It’s where you’ll publish posts and pages, customize your theme, install WordPress plugins, and more.

    Often, when hackers try to get into your website, they’ll do it through the wp-admin screen. You can help to protect your website against potential attacks by using a secure password and limiting login attempts.

    To be even more secure, you can also password-protect the wp-admin directory. Then when someone attempts to access your admin area, they’ll need to enter a username and password before they ever make it to the WordPress login screen.

    With that said, let’s take a look at how you can password-protect your WordPress admin directory step by step.

    The first method is recommended for most users, and you can use the quick links below to jump straight to the method you want to use.

    Method 1: Password-Protect wp-admin Using Directory Privacy (Recommended)

    The easiest way to password-protect your WordPress admin directory is by using your WordPress hosting provider’s Directory Privacy app.

    First, you need to log in to your hosting account dashboard and click on the ‘Directory Privacy’ option in the Files section of your website’s advanced settings.

    Click Directory Privacy

    Note: Most web hosts using cPanel, like Bluehost, will have similar steps. However, your dashboard might be slightly different from our screenshots depending on your hosting provider.

    This brings you to a screen that lists all of the different directories on your server. You need to find the folder that contains your website files.

    For most website owners, this can be found by clicking on the ‘public_html’ folder.

    Click public_html

    This brings up all of the website files you’ve installed on your server.

    Next, you’ll need to click on the folder with your website’s domain name.

    Click domain name folder

    In that folder, you’ll see a ‘wp-admin’ folder.

    Instead of clicking the folder name, you’ll need to click the ‘Edit’ button next to that folder.

    Click edit wp-admin folder

    This brings you to a screen where you can turn on password protection.

    Simply check the box that says ‘Password protect this directory’. If you like, you can also give your directory a name like ‘Admin Area’ to help you remember.

    Check password protect directory box

    Once you’ve done that, you’ll need to click the ‘Save’ button.

    This will take you to a page where the confirmation message will appear.

    Confirmation message click back button

    Now you’ll need to click the ‘Go Back’ button and you’ll be taken to a screen where you can create a user that will be able to access this directory.

    You will be asked to enter a username and password, and then confirm the password. Make sure to note your username and password in a safe place, such as a password manager app.

    Create a User

    Make sure you click the ‘Save’ button when you’ve done that.

    Now, when someone tries to access your wp-admin directory, they will be prompted to enter the username and password you created above.

    Password protect WordPress admin example

    Method 2: Password-Protect wp-admin Using Code

    You can also password-protect your WordPress admin directory manually. To do this you’ll need to create two files called .htpasswd and .htaccess.

    Note: Adding any code to your website can be dangerous. Even a small mistake can cause major errors on your site. We only recommend this method for advanced users.

    Creating the .htaccess File

    First, open up your preferred text editor and name the new file .htaccess.

    After that, you need to copy the following code snippet and add it to the file.

    AuthName "Admins Only"
    AuthUserFile /home/user/public_html/example.com/wp-admin/.htpasswd
    AuthGroupFile /dev/null
    AuthType basic
    require user yourusername
    

    Make sure you change the ‘AuthUserFile’ path to the location where you’ll upload the .htpasswd file and change ‘yourusername’ to the username you want to use to log in.

    Don’t forget to save the file when you’re finished.

    Creating the .htpasswd File

    Once you’ve done that, you need to create a .htpasswd file.

    To do this, open up a text editor and create a file called .htpasswd. This file will list your username along with your password in an encrypted format.

    The easiest way to generate the encrypted password is with a htpasswd generator.

    Simply enter your username and password, select the encryption format, and click the ‘Create .htpasswd file’ button.

    Create htpasswd file

    The htpasswd generator will display a line of text that you need to paste into your .htpasswd file. Make sure you save the file once you’ve done that.

    Uploading .htaccess and .htpasswd to the wp-admin Directory

    The last step is to upload both of the files you created to your website’s wp-admin folder.

    You will need to connect to your WordPress hosting account using an FTP client or the online file manager tool provided by your hosting provider. For more details, see our beginner’s guide on how to use FTP to upload files to WordPress.

    For this tutorial, we’ll use FileZilla because it’s free and works on both Mac and Windows.

    Once you have connected to your website, you will see the files on your computer in the left window, and the files on your website in the right. On the left, you need to navigate to the location where you saved the .htaccess and .htpasswd files.

    Then on the right, you need to go to the wp-admin directory for the website you wish to protect. Most users will need to double-click the ‘public_html’ folder, then the folder with their domain name, then the ‘wp-admin’ folder.

    Now you can select the two files on the left and click ‘Upload’ from the right-click menu or simply drag the files onto the left window.

    Uploading the Files to Your Website's wp-admin Directory

    Now your ‘wp-admin’ directory will be password protected.

    Troubleshooting wp-admin Password Protection

    Depending on how your server and website are set up, there’s a chance you might run into errors. These errors can be fixed by carefully adding code to your .htaccess file.

    Note: This is the .htaccess file located in your main website folder, not the one you uploaded to the ‘wp-admin’ folder. If you’re having trouble finding it, then see our guide on why you can’t find .htaccess and how to locate it.

    Fixing the Ajax Not Working Error

    One of the most common errors is that Ajax functionality may stop working on the front end of your site. If you have WordPress plugins that require Ajax, such as live Ajax search or Ajax contact forms, then you will notice that these plugins won’t work anymore.

    To fix this, simply add the following code to the .htaccess file that’s located in your ‘wp-admin’ folder.

    <Files admin-ajax.php>
        Order allow,deny
        Allow from all
        Satisfy any 
    </Files>
    

    Fixing the 404 Error and Too Many Redirects Error

    Two other errors you might run into are the 404 error and the too many redirects error.

    The simplest way to fix them is to open up your main .htaccess file located in your website directory and add the following line of code before the WordPress rules.

    ErrorDocument 401 default
    

    We hope this article helped you learn how to password-protect your WordPress admin (wp-admin) directory. You may also want to see our expert picks of the best email marketing services for small businesses and our guide on how to get a free email domain.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post How to Password Protect Your WordPress Admin (wp-admin) Directory first appeared on WPBeginner.

  • 10 Ways to Regain Access Once You’re Locked Out of wp-admin

    The post 10 Ways to Regain Access Once You’re Locked Out of wp-admin is written by Tom Rankin and appeared first on WPKube.

    For most WordPress issues, you’ll log into your site and work with the information you get on your dashboard. However, if you’re locked out of wp-admin, you won’t have this luxury. Instead, you’ll need to root out the problem through your server and database. In some cases, human error can play a part. For example, your login credentials could have…. Continue Reading

  • 7 Best WordPress Security Plugins in 2023

    When it comes to website maintenance, the importance of security can’t be understated. With so many risks threatening sites today, making sure yours is protected is critical. Unfortunately, figuring out the best WordPress security plugin to use can be challenging.

    In this post, we’ll explain why you might want a dedicated tool to strengthen your site. Then we’ll introduce you to seven of the best WordPress security plugins, discussing their key features and pricing.

    Let’s get started!

    Subscribe To Our Youtube Channel

    Why You Might Want to Use a WordPress Security Plugin

    Unfortunately, many people don’t spend much time or effort on website security until it’s too late. As a site owner, one of the worst things you can do is put safety on the back burner.

    Between malware, data breaches, and the dozens of other threats plaguing the internet today, taking website security seriously should be a priority for all business owners. If you fall victim to an attack, it can compromise your customers’ data and both the integrity and reputation of your brand.

    Of course, being proactive about protecting your website is often easier said than done. This is why we recommend using a WordPress security plugin. Doing so can place an added layer of protection on your site and reduce your chances of being hacked.

    There is a wide range of functions that a WordPress security plugin can help with. This includes:

    • Strengthening passwords and enabling Two-Factor Authentication (2FA)
    • Updating and backing up WordPress and database files
    • Adding file permissions and user role configurations

    However, it’s important to note that your entire site’s security shouldn’t be dependent on one plugin (nor could it be). Instead, you can think of a WordPress security plugin as a key way to accomplish specific tasks, rather than as a complete solution.

    This is something you may want to keep in mind when considering the following list of security plugins. It’s important to consider what security features you already have access to and what you’re lacking. For example, if backups aren’t something your hosting provider handles, then backup functionality may be a priority.

    7 Best WordPress Security Plugins

    Now that we’ve discussed why site security is so important, it’s time to look at some of the tools that can help. For the following list, we’ve compiled seven WordPress security plugins that cover a wide range of features and functionality. To ensure that we’re presenting you with the best options possible, we’ve also factored in ratings and reviews, customer support and updates, and pricing.

    1. iThemes Security

    The iThemes WordPress security plugin.

    iThemes Security, formerly known as Better WP Security, is another robust tool that deserves a spot as one of the best WordPress security plugins. It comes in both free and premium versions, with multiple tiers available depending on your specific needs.

    This solution helps to secure your site in over 30 different ways, including through password protection, user activity monitoring, and more:

    The iThemes Security plugin settings.

    If you upgrade to the paid version, you will get regular backups of your site. You’ll also be able to remotely manage multiple WordPress sites with the iThemes Security Pro features.

    Key Features:

    • Brute-force attack prevention
    • File integrity monitoring
    • Hidden login and admin pages
    • Limited login attempts
    • 2FA
    • Control over user roles and file permissions
    • Scheduled backups
    • Email alerts
    • 404 error detection
    • Google reCAPTCHAs

    iThemes Security if for you if…

    … you want a beginner- and user-friendly plugin with standard yet powerful security features. It’s also helpful if one of the main tools you’re looking for is backup functionality.

    It’s worth noting that the developers behind the iThemes Security plugin are also the ones who created the popular BackupBuddy plugin. Also, although this plugin doesn’t include a firewall or malware scanner, it does use Sucuri’s malware scanner, which we’ll discuss in more detail in the next section.

    Price: Free, with premium plans starting at $80 | More Information

    2. WP Activity Log

    The WP Activity Log plugin.

    WP Activity Log is a plugin that is slightly different than the others on this list. Rather than offering an all-in-one solution that includes a variety of different features, this tool aims to serve a specific purpose: to help you keep track of every change and activity occurring on your site.

    With this freemium plugin, you can leverage comprehensive activity monitoring to heighten your site’s security:

    The log viewer screen of the WP Activity Log plugin.

    This kind of tool can be particularly helpful if you manage a network of sites. For example, if you manage a team of users, having an easy way to monitor their activity can help keep your site protected from malicious behavior.

    Key Features:

    • Real-time user activity logs
    • Event enabling and disabling
    • Notifications and reports
    • User activity and site change monitoring
    • WooCommerce, Yoast SEO, and WPForms extensions
    • Multisite support
    • HTML and CSV reports (premium only)
    • Free and premium support

    WP Activity Log is for you if…

    … you’re looking for an activity logging and monitoring solution. It’s an awesome choice if you want to gain more insight into your site activity, which can be especially useful if you have a multisite network or need to manage multiple users. However, it’s probably not the best tool if you’re currently lacking a firewall, malware scanner, or other key security features.

    Price: Free, with premium plans starting at $99 | More Information

    3. Sucuri Security

    The Sucuri plugin.

    Similar to Wordfence, Sucuri Security is a popular plugin that can help you with a wide range of security-related tasks on your WordPress site. This includes scanning for malware and running checks:

    Sucuri WP plugin integrity

    One thing we want to note about this plugin is that because it runs a Domain Name Server (DNS)-level firewall, it’s a bit more effective than plugins such as Wordfence that use a built-in WordPress firewall. Therefore, if site performance is of particular concern, Sucuri is an option worth exploring.

    Key Features:

    • Malware scanning and removal
    • Website hardening
    • Application Program Interface (API) key connection
    • Web Application Firewall (WAF) with a premium license
    • Login security, password protection, and user tracking
    • Site tracking (file changes, failed login attempts, etc.)
    • Malicious traffic blocking
    • File integrity and blacklist monitoring
    • Quick and easy setup

    Sucuri is for you if…

    … you’re interested in a WordPress security plugin that operates almost completely offsite. The free version offers a powerful scanner that you can use directly from your WordPress dashboard. However, if you don’t mind paying for the paid version (which we highly recommend), you can get a comprehensive security solution with even more features, including WAF, Secure Sockets Layer (SSL) certificate support, and much more.

    Price: Free, with premium plans starting at $199.99 | More Information

    4. Wordfence Security

    The Wordfence WordPress security plugin.

    With over 4 million active installations and a 4.5 out of 5-star average rating, Wordfence Security is one of the best WordPress security plugins out there. This freemium tool lets you scan your site for malware or any other suspicious activity, such as code injections. Everything is easily managed from the custom Wordfence dashboard:

    The Wordfence plugin dashboard.

    With the paid version, you can access even more features, including advanced, coordinated scanning. Also, because this plugin is so widely used, you can expect to find a great deal of online support if you need it.

    Key Features:

    • Endpoint firewall
    • Scans for file changes
    • IP address blocking
    • Threat assessment features
    • 2FA
    • Monitoring for visits and hack attempts
    • Breached password alerts and custom email notifications
    • Login attempt limits to prevent brute-force attacks
    • Country blocking and redirects (premium only)

    Wordfence is for you if…

    … you’re looking for a premium tool with flexible pricing. The cost varies depending on how many licenses you’ll need. As such, it’s a solid option if you plan to use it on multiple websites or for your clients’ sites.

    The more sites you plan to use this plugin for, the less expensive the premium version becomes. Of course, the free version also comes with a lot of helpful features and can be a great solution on its own.

    Price: Free, with premium plans starting at $99 | More Information

    5. All-In-One WP Security & Firewall

    The All In One WP Security plugin.

    All In One WP Security & Firewall is not as popular as the first three WordPress security plugins on this list. However, it’s still a high-quality option that is worth considering, especially if you’re looking for a free tool. It’s incredibly user-friendly and presents information in visual graphics broken down into three main categories (Basic, Intermediate, and Advanced):

    The All In One WP Security plugin dashboard.

    This plugin also provides a handful of incredibly useful and robust features, especially considering that you don’t have to pay anything for it. This includes brute-force attack prevention, firewall protection, comment spam filtering, and more.

    Key Features:

      • Login Lockdown feature for protecting against brute-force attacks
      • Firewall protection
      • File change detection
      • File backups and restoration
      • Comment spam prevention
      • User account monitoring
      • IP filtering

    All In One WP Security is for you if…

    … you want a free, easy-to-use WordPress plugin to help secure your site. It’s an excellent choice if you only have one (relatively simple) website to manage, and don’t need any overly advanced bells and whistles. It’s also a strong contender if you’re looking for a quick and easy way to understand where your site can be improved, thanks to its grading system.

    Price: Free | More Information

    6. Jetpack

    Jetpack logo

    Next up, Jetpack is one of the most popular and commonly used WordPress plugins out there, so chances are that you’ve probably already heard of it. It can be used for a wide range of features, from performance to marketing purposes. However, there are a few features you may not know about that make it one of the best WordPress security plugins.

    This freemium tool offers intuitive, beginner-friendly security solutions that include real-time backups, malware scanning, and spam protection:

    The Jetpack plugin settings.

    It also helps with brute-force protection and uptime monitoring. Best of all, these features are included in the free plan. It’s also worth noting that this plugin is made by the team behind WordPress.com (Automattic), so you can feel confident knowing that it’s safe, secure, and reliable.

    Key Features:

    • Automatic, real-time backups and restores
    • Malware scanning
    • Spam protection and blocking
    • Brute-force protection
    • Uptime and downtime monitoring
    • 2FA
    • Plugin updates

    Jetpack is for you if…

    … you’re looking for a cost-effective plugin that can be used for a wide range of purposes. If you plan to use it for its security features specifically, however, we suggest upgrading to the premium version. It’s also a solid option if you’re looking to enhance your site’s performance.

    Price: Free, with premium plans starting at $4.77 | More Information

    7. Defender

    Defender Logo

    Defender is a relatively new but promising WordPress security plugin that has received over a million downloads so far. It only takes a few clicks to install and configure the program, and it starts defending your website right away.

    Defender provides an astonishing array of security capabilities without any cost. It offers a firewall with IP blocking enabled for free, just like Wordfence. Malware scans, brute-force login protection, threat notifications, and two-factor authentication via Google are also included in the free edition.

    Key Features of Defender:

    • 2-Factor Authentication
    • Brute force attack prevention
    • Blacklisting features

    Defender dashboard

    This plugin provides many of the key security features you might want to implement; it sports a five-star rating with over 70,000 active users, so you can be confident that this solution can provide you with the security your website needs.

    Defender is for you if…

    …you want to enhance the security of your WordPress website by implementing various security measures such as malware scans, two-factor authentication, brute force protection, and other security enhancements in a simple and user-friendly manner.

    Defender Pricing: Free, $49 per month for the pro version | More Information

    Final Thoughts on WordPress Security Plugins

    With so many WordPress plugins available, it could be a challenge to find the one that works best for you. Choosing the ideal tools for your site may seem difficult because there are so many features and options available in each one; hopefully, you found one that checks your boxes on this list.

    We advise looking into iThemes Security or WP Activity Log if you’re searching for a freemium, all-in-one solution. iThemes offers basic security tools like firewalls and virus scanners, as well as more sophisticated capabilities if you subscribe to a premium license. WP Activity Log, on the other hand, is incredibly useful for monitoring your website’s activities and always staying ahead of security risks.

    Featured Image via

    The post 7 Best WordPress Security Plugins in 2023 appeared first on Elegant Themes Blog.