403 forbidden error image

Рассказываем о причинах появления ошибки 403 Forbidden Error (Доступ запрещен) и методах ее исправления. Пошаговая инструкция по устранению ошибки сервера со стороны владельца сайта и пользователя.

Все мы, путешествуя по просторам интернета, натыкаемся на различные ошибки при загрузке сайтов. Одна из них, кстати, достаточно часто встречается – я говорю об ошибке сервера 403 Forbidden Error. Сегодня я рассмотрю причины ее возникновения и способы устранения со стороны владельца сайта и его пользователя.

Что означает ошибка 403 и почему она появляется

Ошибка сервера 403 Forbidden означает ограничение или отсутствие доступа к материалу на странице, которую вы пытаетесь загрузить. Причин ее появления может быть несколько, и вот некоторые из них:

  • Формат индексного файла неверен.
  • Некорректно выставленные права на папку/файл.
  • Файлы были загружены в неправильную папку.

Комьюнити теперь в Телеграм

Подпишитесь и будьте в курсе последних IT-новостей

Подписаться

Исправление ошибки сервера 403 Forbidden

Чтобы исправить ошибку сервера 403 Forbidden, обязательно нужен доступ к панели управления вашего хостинга. Все описанные ниже шаги применимы к любой CMS, но примеры будут показаны на основе WordPress.

Проверка индексного файла

Сначала я проверю, правильно ли назван индексный файл. Все символы в его имени должны быть в нижнем регистре. Если хотя бы один символ набран заглавной буквой, возникнет ошибка 403 Forbidden. Но это больше относится к ОС Linux, которой небезразличен регистр.

Еще не стоит забывать, что индексный файл может быть нескольких форматов, в зависимости от конфигураций сайта: index.html, index.htm, или index.php. Кроме того, он должен храниться в папке public_html вашего сайта. Файл может затеряться в другой директории только в том случае, если вы переносили свой сайт.

Проверка индексного файла на наличие и правильность ввода

Любое изменение в папке или файле фиксируется. Чтобы узнать, не стала ли ошибка итогом деятельности злоумышленников, просто проверьте графу «Дата изменения».

Настройка прав доступа

Ошибка 403 Forbidden появляется еще тогда, когда для папки, в которой расположен искомый файл, неправильно установлены права доступа. На все директории должны быть установлены права на владельца. Но есть другие две категории:

  • группы пользователей, в числе которых есть и владелец;
  • остальные, которые заходят на ваш сайт.

На директории можно устанавливать право на чтение, запись и исполнение.

Так, по умолчанию на все папки должно быть право исполнения для владельца. Изменить их можно через панель управления TimeWeb. Для начала я зайду в раздел «Файловый менеджер», перейду к нужной папке и выделю ее. Далее жму на пункт меню «Файл», «Права доступа».  

Как изменить права доступа к файлу в файловом менеджере TimeWeb

Откроется новое окно, где я могу отрегулировать права как для владельца, так и для всех остальных.

Как должны быть выставлены права доступа для всех папок

Отключение плагинов WordPress

Если даже после всех вышеперечисленных действий ошибка не исчезла, вполне допустимо, что влияние на работу сайта оказано со стороны некоторых плагинов WordPress. Быть может они повреждены или несовместимы с конфигурациями вашего сайта.

Для решения подобной проблемы необходимо просто отключить их. Но сначала надо найти папку с плагинами. Открываю папку своего сайта, перехожу в раздел «wp-content» и нахожу в нем директорию «plugins». Переименовываю папку – выделяю ее, жму на меню «Файл» и выбираю соответствующий пункт. Название можно дать вот такое: «plugins-disable». Данное действие отключит все установленные плагины.

Отключение плагинов через файловый менеджер TimeWeb

Теперь нужно попробовать вновь загрузить страницу. Если проблема исчезла, значит, какой-то конкретный плагин отвечает за появление ошибки с кодом 403.

Но что делать, если у вас плагин не один, а какой из них влияет на работу сайта – неизвестно? Тогда можно вернуть все как было и провести подобные действия с папками для определенных плагинов. Таким образом, они будут отключаться по отдельности. И при этом каждый раз надо перезагружать страницу и смотреть, как работает сайт. Как только «виновник торжества» найден, следует переустановить его, удалить или найти альтернативу.

Читайте также

Ошибки сервера HTTP

Как исправить ошибки SMTP-сервера при отправке писем

Как решить проблему, если вы – пользователь

Выше я рассмотрела способы устранения ошибки 403 Forbidden для владельцев сайта. Теперь же разберу методы исправления в случаях с пользователем.

  • Сначала надо убедиться, что проблема заключается именно в вашем устройстве. Внимательно проверьте, правильно ли вы ввели URL сайта. Может, в нем есть лишние символы. Или, наоборот, какие-то символы отсутствуют.
  • Попробуйте загрузить страницу с другого устройства. Если на нем все будет нормально, значит, проблема кроется именно в используемом вами девайсе. Если нет – надо перейти к последнему шагу.
  • Еще хороший вариант – немного подождать и обновить страницу. Делается это либо кликом по иконке возле адресной строки браузера, либо нажатием на комбинацию Ctrl + F5. Можно и без Ctrl, на ваше усмотрение.
  • Если ничего из вышеперечисленного не помогло, надо очистить кэш и cookies. Провести такую процедуру можно через настройки браузера. Для этого необходимо открыть историю просмотров, чтобы через нее перейти к инструменту очистки. Эту же утилиту часто можно найти в настройках, в разделе «Конфиденциальность и безопасность». В новом окне нужно отметить пункты с кэшем и cookies и нажать на кнопку для старта очистки.Очистка кэша и cookies в браузере Google Chrome
  • Ошибка 403 Forbidden возникает и тогда, когда пользователь пытается открыть страницу, для доступа к которой сначала надо осуществить вход в систему. Если у вас есть профиль, просто войдите в него и попробуйте вновь загрузить нужную страницу.
  • Если вы заходите со смартфона, попробуйте отключить функцию экономии трафика в браузере. Она находится в настройках, в мобильном Google Chrome под нее отведен отдельный раздел. 
  • Последний шаг – подождать. Когда ни один способ не помогает, значит, неполадки возникли именно на сайте. Возможно, его владелец уже ищет способы решения проблемы и приступает к их исполнению, но это может занять какое-то время. Пользователям остается только дождаться, когда все работы будут завершены.

Еще одна допустимая причина появления ошибки сервера 403 – доступ к сайту запрещен для определенного региона или страны, в которой вы находитесь. Бывает и такое, что сайт доступен для использования только в одной стране. Если вы используете VPN, попробуйте отключить его и перезагрузите страницу. Вдруг получится все исправить. 

Если ничего из вышеперечисленного не сработало, рекомендуется обратиться к владельцу сайта. Есть вероятность, что никто не знает о возникшей проблеме, и только ваше сообщение может изменить ситуацию. 

if you look at http://laponderosakennels.com/beagles/memories/Ginger.jpeg it throws a 403 error.. there is a permission issue for the same.

The problem is probably cos you are referring to the wrong file.. i took the liberty of looking at your folder structure and you are referring to ginger.jpeg which has a permission issue and there is a file ginger.jpg that works fine.

Also make sure you refer to the file correctly.. i.e ginger.jpg

answered Sep 25, 2011 at 6:50

Baz1nga's user avatar

1

This can also be caused by using hotlinking protection. So if hotlinking protection is used, make sure that the URL for your website is added to the white list. Also keep in mind that www.yourdomain.com and yourdomain.com are considered two different URLs.

answered Sep 23, 2013 at 1:53

Casey Gibson - AOAUS's user avatar

1

403 stands for permission denied. You need to check the permissions for «Ginger.jpeg».

answered Sep 25, 2011 at 6:52

ace's user avatar

aceace

7,0933 gold badges22 silver badges28 bronze badges

2

Recently I saw that some of the images were not displayed on a particular webpage, I checked if the image was available under the images folder, yes it was with the correct name!

I checked the Chrome Browser’s console logs and It said: GET http://localhost/myapp/images/4.jpg 403 (Forbidden). I tried accessing the image via URL and I could see this access type error!

Access forbidden!

You don't have permission to access the requested object.
It is either read-protected or not readable by the server.

If you think this is a server error, please contact the webmaster.

Error 403

localhost
Apache/2.4.10 (Unix) OpenSSL/1.0.1i PHP/5.5.15 mod_perl/2.0.8-dev Perl/v5.16.3

Reason for 403: Well it was obvious that it has something to do with the access permissions of the file, as I work on a Unix based operating system.

Solution to resolve 403 forbidden error:

Check the access permissions for the file: Read permission should be allowed for the Others, its best to make permission settings to 644 using CHMOD

644 = (rw- r— r—): group/others can to read the file. The owner can write to it, others cannot write or execute it.

I hope it helps someone!

Table of Contents

  • Introduction: What is a 403 Error?
  • Firewall Rules
  • 403 on an Image or File
  • Caching and Nonces
  • File Permissions
  • CDN Issues
  • Corrupt/Misconfigured .htaccess file
  • Broken/Missing Plugins
  • Custom Nginx Config Rules

Introduction: What is a 403 Forbidden Error?

The 403 Forbidden error occurs when a request is made the server cannot allow. This is often due to a firewall ruleset that strictly prohibits this specific request, but other settings such as permissions may prevent access based on user rights.

When 403s occur, your server understands the request that is being made, but is refusing to comply with the request. 

That’s about all there is to it. Your request is forbidden.

Error Messaging

On Nginx a 403 looks as follows: 403 Forbidden – nginx

Other variations of a 403 include:

  • 403 – Forbidden: Access is denied
  • Error 403 – Forbidden
  • 403 – Forbidden Error – You are not allowed to access this address
  • HTTP Error 403 – Forbidden – You do not have permission to access the document or program you requested
  • 403 Forbidden – Access to this resource on the server is denied


Note

The following are all certainly possibilities for your 403 errors, however, in 90% of cases, 403 errors are caused by a firewall, caching issue, or permissions issue.

1. Firewall Rules

By far the most common reason for 403 errors is that the request you’re making is being blocked for breaking one of the firewall rules.

Unlike most other hosting providers, GridPane equips you with 1-3 different Web Application Firewall (WAF) options depending on your plan: –

  1. 6G WAF
  2. 7G WAF
  3. ModSecurity

Usually, 403s are a good thing. In most cases, these types of requests are malicious in nature and the firewall blocks those from even reaching your application (WordPress website). However, WordPress is a vast ecosystem of different functionality and false positives can and do occur.

The quickest way to discover if your 403 error is being caused by a WAF is to simply turn it off and try to reproduce the issue. If the 403 no longer occurs, this is a WAF issue.

You can find out the specific reason the request is being blocked by checking the log. This is available directly inside the security tab at the bottom of the settings.

Once you know the cause, you can begin crafting an exclusion that is fairly straightforward, and fully documented in the links above.

Example

Here’s an example of a request that resulted in a 403 error with the 7G WAF:

website.com/wp-admin/admin.php?page=seopress-google-analytics&code=4/0AY0eSoaWlA&scope=https://www.googleapis.com/auth/analytics.readonly

This request broke 2 rules, as detailed by this result in the 7G WAF log:

[17/Nov/2020:15:05:35 +0000] [":bad_querystring_12::bad_request_15:"] 199.199.199.199 yourdomain.com "GET /wp-admin/admin.php?page=seopress-google-analytics&code=4/0AY0e-g44ZrE9024kffJQ2LbRdRxVLOQgAruyU9wAHI1jYFCDaUo10xmwW5rpilPzqNKOSoaWlA&scope=https://www.googleapis.com/auth/analytics.readonly HTTP/1.1" 403 "https://accounts.google.com/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36"

Using this information we can create a rule to exclude these two results by targeting “page=seopress-google-analytics&code” and adding an exclusion for both errors like so:

set $exclusion_rule_match "";
if ( $args ~* ^page=seopress-google-analytics&code ) {
set $exclusion_rule_match 15;
}
if ($bad_request_7g = $exclusion_rule_match) {
set $7g_drop_bad_request 0;
}
set $exclusion_rule_match "";
if ( $args ~* ^page=seopress-google-analytics&code ) {
set $exclusion_rule_match 12;
}
if ($bad_querystring_7g = $exclusion_rule_match) {
set $7g_drop_bad_query_string 0;
}

Please see the full articles for a complete tutorial.

403 on an Image or File

Following on from the above section, images or files may sometimes return a 403 for a seemingly unknown reason.

These can be difficult to troubleshoot because it’s really not obvious what the cause is, however, this is almost certainly either the 7G firewall.

A couple of examples to illustrate this are images/files that contain either the word “Specialist” or the word “Conference”. 

The reason these get flagged are due to the word conference containing “conf” (which is a file name extension), and specialist containing the name of a commonly spammed pharmaceutical.

The quickest solution is to rename the file, or to edit out that specific line or word in the firewall. Our documentation has details how to do this here:

Using the GridPane 7G Web Application Firewall

2. Caching and Nonces

The second most common issue outside of a firewall rule being is broken is where caching is interfering with a form (such as a contact form, or payment gateway form). Here, the form uses what’s called a “nonce” (a security token which is a number or random string used only once), which exists for a set period of time (12 hours is common) after which it changes to something new. Once change occurs, the cache may serve the outdated nonce and this results in an error.

If you have a form or any functionality that makes use of a nonce, these can break and return 403 errors if the cache isn’t cleared once the nonce expires.

In many cases, nonces last 12-24 hours. For example, the Gravity forms payment gateway has a 12-hour nonce and can result in 403 errors if cached for over 12 hours.

If clearing the cache allows your functionality to begin operating correctly again, this is a caching issue.

Plugins we know of that may experience cache related issues are:

  1. Gravity Forms Payments
  2. Divi Forms
  3. Caldera Forms

In these cases, there are a couple of different solutions.

Solution 1. Exclude the page from the cache

If you exclude the page from the cache, the cache will not interfere with the nonce and all forms will operate as normal. 

Please see the following guide on how to exclude a page from your website’s cache (Nginx only):

Exclude a page from server caching

Solution 2. Reduce Cache TTL

If you’re using Redis Page Caching, the default TTL is 30 days. If you’re experiencing nonce related form failures, you can reduce the cache time to avoid these in the future.

This requires running a single GP-CLI command. To do so, you will need to SSH into your server. Please see the following guides to get started:

The command for altering the default caching TTL is as follows:

gp stack nginx redis -site-cache-valid {accepted.value} {site.url}

Run the following command to reduce cache time to 6 hours (replacing site.url with your domain name):

gp stack nginx redis -site-cache-valid 21600 site.url

The time length has to be entered in seconds. In this case, 6 hours = 21600 seconds.

For 10 hours, run the following:

gp stack nginx redis -site-cache-valid 36000 site.url

For more details, please see this Redis Page caching section in the Configure Nginx article:

Set caching expiry time for all successful requests going into Redis SRCache page cache

3. Permissions

403 errors can also be caused by incorrect permissions settings. This can sometimes occur when migrating a website over to GridPane.

Fortunately, we have a quick fix self-help tool that can help reset your website to the correct permissions very quickly and with minimal fuss. To fix your websites permissions, please see this article:

Self Help Tools: Reset Application File Permissions

4. CDN Issues

If the 403 forbidden errors you’re experiencing are specific to your assets (images, CSS, and JS files), and you’re using a delivery network (CDN) for your website, try temporarily disabling this service to see if this is at the root of your issue.

If it isn’t, this is likely firewall related, possibly due to 7G Bad Bot rule #5.

5. Corrupt/Misconfigured .htaccess File

Nginx doesn’t use .htaccess, so this error is OpenLiteSpeed specific for GridPane hosted websites.

This is a very powerful file, and if corrupted or misconfigured, this could result in a 403 error for your website.

Fortunately, GridPane keeps a backup copy that you can use in the case of an emergency:

You can get your website back up and running by replacing the current .htaccess file with the contents of the .htaccess.save file.

This is easier done over SFTP. To connect to your server over SFTP, please see either one of the following articles:

Connect to a GridPane Server by SFTP as System User

Connect to a GridPane Server by SFTP as Root user

Step 1

Once connected, first save a copy of the .htaccess.save file to your computer.

Step 2

Next, rename the corrupt .htaccess file to .htaccess.bad

Step 3

Next, rename .htaccess.save to .htaccess and then check your website.

Step 4

You can now re-upload the .htaccess.save to your server again for safekeeping, and delete the .htaccess.bad file.

6. Broken/Missing Plugin Files

If none of the above is the cause for your 403 error, then this could be the work of a broken or missing plugin file.

To check, connect to your server over SFTP (see the links in part 5 above to get started) and rename the plugins folder (located at site.url/htdocs/wp-content/plugins) to plugins-off.

Next, check your website and see if the 403 error is occurring. If not, then you know the root cause is one of the plugins on your website.

Rename the plugins-off directory back to plugins, and then do the same for each of your individual plugin folders, renaming them one by one until you find the one responsible.

7. Custom Nginx Configurations

Sometimes plugin authors can be rather careless with their Nginx recommendations, documenting broad Nginx rules that can result in unexpected/undesirable behavior such as blocking specific types of files altogether, or blocking them when not logged into the website.

You may have added custom configuration rules to Nginx via .conf files in your  /var/www/site.url/nginx directory.

For example:

/var/www/example.com/nginx/ithemes-security-main-context.conf

Custom configurations that affect ALL websites on the server may also have been added in these directories:

/etc/nginx/extra.d/
/etc/nginx/conf.d/

Be sure to check this directory for any Nginx configuration files that you or your team members may have added (be sure to ask them so you know what to look for), and review them for code that could prevent access to page or file that your getting your 403 forbidden error.

Introduction

When a web server denies access to a particular webpage or web content, it displays the 403 Forbidden error. Different web servers report different variations of the 403 Forbidden error.

In this article, you will learn what a 403 error is and how to fix it.

403 Forbidden Error - what is it and how to fix it

The 403 Forbidden error happens when a web server denies access to a webpage to a user trying to access it trough a web browser. The name «403 error» derives from the HTTP status code that the web server uses to describe that type of error.

There are several variations of the error and several reasons why the web server has denied access. The following sections deal with the different ways the error is displayed and its causes.

Common 403 Error Messages

Like with other errors, webmasters can customize how the 403 error is displayed. Its contents also depend on the web server used. That is why there are many different 403 pages across different websites.

Some common 403 error messages are:

  • 403 Forbidden
  • HTTP 403
  • Forbidden
  • HTTP Error 403 – Forbidden
  • HTTP Error 403.14 – Forbidden
  • Error 403
  • Forbidden: You don’t have permission to access [directory] on this server
  • Error 403 – Forbidden
  • 403 Forbidden Error
  • 403 Error
An example of a 403 Forbidden error.

The image above shows an example of a 403 Forbidden error served by an Nginx web server.

What Causes the 403 Forbidden Error

The 403 Forbidden error usually occurs due to access misconfiguration. The misconfiguration involves improper read, write, or execute permission settings for a file or directory.

Possible causes for the 403 Forbidden error are:

  • An empty website directory. If there is no index.php or index.html page, the 403 error displays.
  • Missing index page. The 403 error may occur if the homepage name isn’t index.html or index.php.
  • Permission/ownership errors. Incorrect permission settings or ownership cause the 403 error.
  • Incorrect .htaccess file settings. The .htaccess file holds important website configuration settings, and it could be corrupted.
  • Malware infection. If your files are infected with malware, it can keep corrupting the .htaccess file.
  • Cached outdated webpage. The 403 error comes up if the page link has been updated, which is now different from the cached version.
  • Faulty plugin. Improperly configured WordPress plugins or their incompatibility could trigger the 403 error.

The following section deals with different ways of fixing the 403 Forbidden error.

How to Fix the 403 Forbidden Error (Tips for Webmasters)

You can do several things to fix the 403 Forbidden error, depending on whether you are a website visitor or a webmaster.

The following fixes for the 403 Forbidden error are resources for site webmasters:

Check Website Directory

An empty website directory may cause the 403 error. Make sure that the content is in the correct directory on the server.

Depending on the server you are using, the correct directory for your content is:

  • For Nginx: /var/www/vhosts/domain.com/httpdocs/
  • For Apache: /home/username/public_html/

If there is no such directory, create one.

Add an Index Page

The website homepage by default is index.html or index.php. If there is no such page on your website, the visitors can encounter a 403 Error. Resolve this by uploading an index page to your httpdocs or public_html directory.

If you already have a homepage named other than index, you can rename it or set up a redirect in your .htaccess file to that homepage.

Warning: Be careful when editing the .htaccess file as it contains server configuration instructions and affects your web server’s behavior. The file is usually hidden as a precaution, but you can find it in your public_html directory by checking the Show Hidden Files option.

To redirect to your homepage, follow the steps below:

1. Log in to cPanel and navigate to your public_html directory.

Note: You can also download and edit the .htaccess file locally using an FTP client instead of cPanel.

2. Right-click the .htaccess file and choose Edit from the dropdown menu.

Edit the .htaccess file in cPanel.

3. Redirect the index.php or index.html file to your existing homepage by inserting the following code snippet:

redirect /index.html /homepage.html

Replace homepage.html with the actual name of your page.

Check File and Directory Permissions

Each file and directory on your website have permissions that control access to those files and directories. Incorrect file or directory permissions can cause the 403 Forbidden error. The permissions specify who has read or write access to the file or directory in question.

The permissions are represented with numeric values. The general practice is to use:

  • 755 for directories
  • 644 for static content
  • 700 for dynamic content

Note: Linux file permissions can include numbers, letters, or words, as well as an entry stating to whom the file has been assigned — Owner, Group, or Both.

You can change file permissions recursively with the chmod command. If you prefer a GUI, use an FTP client to change file or directory permissions.

Create a New .htaccess File

A 403 error can be the result of improper .htaccess file configuration. The .htaccess file controls the high-level website configuration.

Follow the steps below to check if the .htaccess file is the cause of the 403 error:

1. Find the .htaccess file via your file management software (e.g., cPanel) or via an sFTP or FTP client.

2. Right-click the .htaccess file and select Download to create a local backup.

Download the .htaccess file in cPanel.

3. Next, click Delete to delete the file.

4. Visit your website. If the 403 error no longer appears, it means that the .htaccess file was corrupt.

5. Now you need to generate a new .htaccess file. Log in to your dashboard and click Settings > Permalinks.

Find Permalinks in WordPress dashboard.

6. Don’t make any changes. Just click the Save Changes button to create a new .htaccess file.

Visit your website to check if the error is fixed.

Enable Directory Browsing

If the website shows a 403 error when you’re trying to browse a directory, you may need to enable directory browsing in your web server software. You can turn on directory browsing in the config file. If you don’t feel confident editing the config files yourself, seek help from a web master or your hosting provider.

The following examples show how to enable directory browsing in different web servers:

  • IIS Express

1. Open the Web.config file of your project.

2. Add the following tags within <system.webServer>:

<directoryBrowse enabled="true" />
<modules runAllManagedModulesForAllRequests="true" />
  • Nginx

Change the autoindex value to on in the config file:

The following is an example of the config file with the on value for autoindex.

server {
 listen 80;
 server_name phoenixnap.com www.phoenixnap.com;
 access_log /var/...........................;
 root /path/to/root;
 location / { index index.php index.html index.htm; }
 location /somedir { autoindex on; }
}

Apache

You have to specify the DirectoryIndex directive in the site’s .conf file (found in /etc/apache2/sites-available on Linux).

Turn on directory browsing in the Options directive. Following is an example of the .conf file with directory browsing turned on:

<Directory /usr/local/apache2/htdocs/listme>
  Options +Indexes
</Directory>

Contact the Hosting Company

The reason for the 403 Forbidden error could be with the hosting company and not with you. If everything else fails to remove the error, get in touch with your hosting company and let them check what could be causing the issue.

Disable WordPress Plugins

Sometimes, a faulty or incompatible plugin is what causes a 403 forbidden error. You can try to fix the error by disabling all plugins to check if the error goes away.

Follow the steps below to disable all plugins:

1. Log into the WP Admin and navigate to Plugins > Installed Plugins.

2. Select all plugins, choose Deactivate from the drop-down menu and click Apply.

3. Try to access your website. If there is no 403 forbidden error, that means that the cause was one of the plugins.

4. Now enable one plugin at a time to determine which one is causing the 403 error. When you find the root of the problem, update or remove the plugin or install an alternative one to resolve the issue.

Check the A Record

One of the reasons for the 403 Forbidden error can be a domain name pointing to the wrong IP address, where you don’t have the permission to view the content. This happens when the A record of a migrated website still points to the old IP address.

Follow the steps below to check if the domain A record points to the right IP address:

1. Log in to cPanel.

2. In the Domains section, click DNS Zone Editor.

Find the DNS Zone Editor in cPanel.

3. In the list of DNS records, find the record with the A label in the Type column.

Find the record with the A label in the Type column

4. Check if the A record IP address in the Record column is correct. If it’s wrong, click Edit to change it.

5. Click Update to finish.

Revisit the website to see if the issue has been resolved.

Scan for Malware

Having malware on your web server can cause the 403 Forbidden error. The malware can keep injecting unwanted lines into the .htaccess file, and that way the error persists even if you generate a new .htaccess file.

Use a security plugin to scan your web server for malware and remove it if any is found. Most plugins also offer actions when detecting malware infected files, such as deleting the infected file or restoring it.

Some of the best security plugins for WordPress are Sucuri, Wordfence, Defender, etc.

How to Fix the 403 Forbidden Error (Tips for Site Visitors)

If you are a site visitor that has encountered the 403 error, below is a list of things you can try to fix the issue.

Check URL

A wrong URL is a common cause of the 403 Forbidden error. Make sure that you’re trying to access an actual webpage instead of a directory.

Many websites don’t allow visitors to browse through directories, so if you are trying to acces a directory, you will likely get a 403 Forbidden error.

Clear History/Cache

Your browser stores cached webpages to load them faster the next time you visit them. Sometimes the website link has been updated, making the actual link different from the cached version. Loading the cached version then results in a 403 error.

The stored cookies on your browser can also cause the 403 error. If the cookies are invalid or corrupted, they can cause improper server authentication. Clearing browser cache and cookies should resolve this issue.

Note: Clearing the browser cache and cookies means that the next time you load the webpage, your browser requests all the site files again, making it load slower. Clearing the cookies also signs you out from all logged-in websites.

Follow the steps below to clear the cache and cookies on Google Chrome:

  1. Click the three-dot button on the top right corner and select Settings.
Open settings in Chrome.

2. Find the Privacy and security section and click Clear browsing data.

Clearn browsing data in Chrome.
  1. In the drop-down menu, select the data deletion time frame.
  2. Check the Cookies and other site data and Cached images and files options and click Clear data.
Clear cache and cookies in Google Chrome.

Try to reload the site to see if the problem persists.

Log in

A 403 Forbidden error code could sometimes appear because you need to log in to a website to access a page. If possible, log in with your credentials to gain access to the content.

Note: Although the 401 error is usually displayed when you need special permission to access content, sometimes the 403 Forbidden error is displayed instead.

Reload the Page

Sometimes, reloading the page is the trick to getting around the 403 Forbidden error. Each browser has its own reload button near the address bar. Press Ctrl+F5 on Windows and Linux or Cmd+Shift+R on Mac to reload the page if you prefer using the keyboard.

Try Later

If you aren’t the only one denied access to the website, then the problem is usually with the host. Revisit the site later and see if the issue has been resolved.

Contact Your ISP

If you cannot get around the 403 error on a website, but it works for other people, contact your internet service provider (ISP).

Your IP address could be added to a blocklist, and it is causing the 403 forbidden error. In that case, your ISP cannot help you, and the only way to access the website is to use a VPN.

Conclusion

High website availability provides the best user experience and shows reliability. That is why website owners try to keep their site available at all times and invest in website maintenance services.

Preventing or quickly resolving HTTP errors is crucial if you want to retain your visitors. After reading this guide, you should be able to promptly fix the 403 Forbidden error and keep your business running.

Did you just try to access your WordPress site only to be hit by some message telling you something is “Forbidden” or that you don’t have permission to access something on your site? If so, you’ve likely run into the 403 Forbidden error on WordPress.

Seeing an error on your WordPress site can be frustrating and deflating, which is why we’ve created this detailed guide to help you fix the 403 Forbidden Error on WordPress and get your site functioning again as quickly as possible.

Let’s get started without any further introduction because we’re sure you just want to fix your site!

Prefer the video version?

What is the 403 Forbidden Error?

The Internet Engineering Task Force (IETF) defines the error 403 Forbidden as:

The 403 (Forbidden) status code indicates that the server understood the request but refuses to authorize it. A server that wishes to make public why the request has been forbidden can describe that reason in the response payload (if any).

Error Code 403
Error Type Authentication error
Error Variations Forbidden – You don’t have permission to access / on this server

403 – Forbidden: Access is denied

Error 403 – Forbidden

403 – Forbidden Error – You are not allowed to access this address

403 Forbidden – nginx

HTTP Error 403 – Forbidden – You do not have permission to access the document or program you requested

403 Forbidden – Access to this resource on the server is denied

403. That’s an error. Your client does not have permission to get URL / from this server

You are not authorized to view this page

It appears you don’t have permission to access this page

Error Causes Corrupt .htaccess file

Incorrect file permissions

Plugin issues

Like many other common WordPress errors, the 403 Forbidden error is an HTTP status code that a web server uses to communicate with your web browser.

403 forbidden error in Chrome

403 forbidden error in Chrome

Quick background on HTTP status codes – whenever you connect to a website with your browser, the web server responds with something called an HTTP header. Usually, this all happens behind the scenes because everything is working normally (that’s a 200 status code, in case you were wondering).

However, if something goes wrong, the server will respond back with a different numbered HTTP status code. While these numbers are frustrating to encounter, they’re actually quite important because they help you diagnose exactly what’s going wrong on your site.

The 403 Forbidden error means that your web server understands the request that the client (i.e. your browser) is making, but the server will not fulfill it.

In more human-friendly terms, it basically means that your server knows exactly what you want to do, it just won’t let you do it because you don’t have the proper permissions for some reason. It’s kind of like you’re trying to get into a private event, but your name got accidentally removed from the guestlist for some reason.

Other HTTP status codes mean different things. We’ve written guides on fixing issues with 404 not found errors, 500 internal server errors, 502 bad gateway errors, and 504 gateway timeout errors.

What Causes the 403 Forbidden Error on WordPress?

The two most likely causes of the 403 Forbidden Error on WordPress are:

  1. Corrupt .htaccess file
  2. Incorrect file permissions

It’s also possible that you’re seeing the error because of an issue with a plugin that you’re using at your site. In this article, we’ll show you how to troubleshoot all of these potential issues.

403 Forbidden Error Variations

Like many other HTTP status codes, there are a lot of different variations for how this error code presents itself.

Here are some common variations that you might come across:

  • “Forbidden – You don’t have permission to access / on this server”
  • “403 – Forbidden: Access is denied”
  • “Error 403 – Forbidden”
  • “403 – Forbidden Error – You are not allowed to access this address”
  • “403 Forbidden – nginx”
  • “HTTP Error 403 – Forbidden – You do not have permission to access the document or program you requested”
  • “403 Forbidden – Access to this resource on the server is denied”
  • “403. That’s an error. Your client does not have permission to get URL / from this server”
  • “You are not authorized to view this page”
  • “It appears you don’t have permission to access this page.”

If you’re on an Nginx server, it will look like this below. Basically, if you see any mention of “forbidden” or “not allowed to access”, you’re probably dealing with a 403 Forbidden error.

What the 403 Forbidden Error looks like at Kinsta

What the 403 Forbidden Error looks like at Kinsta

How to Fix 403 Forbidden Error on WordPress

To help you fix the 403 Forbidden Error on your WordPress site, we’ll cover five separate troubleshooting steps in detail:

  • File permissions
  • .htaccess file
  • Plugin issues
  • CDN issues
  • Hotlink protection

1. Modify Your File Permissions

Each folder and file on your WordPress site’s server has its own unique file permissions that control who can:

  • Read – see the data in the file/view the contents of a folder.
  • Write – modify the file/add or delete files inside a folder
  • Execute – run the file and/or execute it as a script/access a folder and perform functions and commands.

These permissions are indicated by a 3-digit number, with each digit indicating the level of permission for each of the 3 categories above.

Normally, these permissions just “work” for your WordPress site. However, if something gets messed up with the file permissions at your WordPress site, it can cause the 403 Forbidden error.

To view and modify your site’s file permissions, you’ll need to connect via FTP/SFTP. Here’s how to use SFTP if you’re hosting at Kinsta.

For the screenshots in the tutorial below, we’ll be using the free FileZilla FTP program. The basic principles will apply to any FTP program, though – you’ll just need to apply them to a different interface.

Once you’re connected to your server, you can view a file or folder’s permissions by right-clicking on it:

View file permissions in FileZilla

View file permissions in FileZilla

Of course, manually checking the permissions for each file or folder isn’t really an option. Instead, you can automatically apply file permissions to all the files or folders inside of a folder.

According to the WordPress Codex, the ideal file permissions for WordPress are:

  • Files  – 644 or 640
  • Directories – 755 or 750

One exception is that your wp-config.php file should be 440 or 400.

To set these permissions, right-click on the folder that contains your WordPress site (the folder name is public at Kinsta). Then, choose File Attributes:

Bulk edit file permissions in FileZilla

Bulk edit file permissions in FileZilla

Enter 755 or 750 in the Numeric value box. Then, choose Recurse into subdirectories and Apply to directories only:

File permissions for WordPress directories

File permissions for WordPress directories

Once you’ve applied the correct permissions for directories, you’ll repeat the process for files. Only this time:

  • Enter 644 or 640 in the Numeric value box
  • Choose Recurse into subdirectories
  • Choose Apply to files only

File permissions for WordPress files

File permissions for WordPress files

To finish the process, you just need to manually adjust the permissions for your wp-config.php file to make them 440 or 400:

File permissions for wp-config.php file

File permissions for wp-config.php file

If file permissions issues were causing the 403 Forbidden Error, your site should now start working again.

2. Delete and Restore the .htaccess File

Kinsta uses the NGINX web server, so this potential issue doesn’t apply if you’re hosting your site at Kinsta because Kinsta sites do not have a .htaccess file.

However, if you’re hosting elsewhere and your host uses the Apache web server, one common cause of the 403 Forbidden error is a problem in your site’s .htaccess file.

The .htaccess file is a basic configuration file used by the Apache web server. You can use it to set up redirects, restrict access to all or some of your site, etc.

Because it’s so powerful, even if a little mistake can cause a big issue, like the 403 Forbidden error.

Rather than trying to troubleshoot the .htaccess file itself, a simpler solution is to just force WordPress to generate a new, clean .htaccess file.

To do that:

  • Connect to your server via FTP
  • Find the .htaccess file in your root folder
  • Download a copy of the file to your computer (it’s always a good idea to have a backup just in case)
  • Delete the .htaccess file from your server after you have a safe backup copy on your local computer

Delete the .htaccess file

Delete the .htaccess file

Now, you should be able to access your WordPress site if your .htaccess file was the issue.

To force WordPress to generate a new, clean .htaccess file:

  • Go to Settings → Permalinks in your WordPress dashboard
  • Click Save Changes at the bottom of the page (you do not need to make any changes – just click the button)

How to generate a new, clean .htaccess file

How to generate a new, clean .htaccess file

And that’s it – WordPress will now generate a new .htaccess file for you.

3. Deactivate and then Reactivate Your Plugins

If neither your site’s file permissions nor .htaccess file are the problems, the next place to look is your plugins. It could be a bug in a plugin or a compatibility issue between different plugins.

No matter what the issue is, the easiest way to find the problematic plugin is with a little trial and error. Specifically, you’ll need to deactivate all of your plugins and then reactivate them one by one until you find the culprit.

If you can still access your WordPress dashboard, you can perform this process from the normal Plugins area.

If you cannot access your WordPress dashboard, you’ll instead need to connect to your WordPress site’s server via FTP/SFTP (here’s how to connect via SFTP at Kinsta).

Once you’re connected to your server via FTP:

  1. Browse to the wp-content folder
  2. Find the plugins folder inside of the wp-content folder
  3. Right-click on the plugins folder and choose Rename
  4. Change the name of the folder. You can name it anything different, but we recommend something like plugins-disabled to make it easy to remember.

Rename the plugins folder

Rename the plugins folder

By renaming the folder, you’ve effectively disabled all the plugins at your site.

Now, try accessing your site again. If your site is working, you know that one of your plugins is causing the 403 Forbidden error.

To find the culprit, reactivate your plugins one-by-one until you find which plugin is causing the issue.

After changing the file name of the plugins folder, you should see a number of errors that say plugin file does not exist when you go to the Plugins area on your site:

What happens after renaming the plugins folder

What happens after renaming the plugins folder

To fix this issue and regain the ability to manage your plugins, use your FTP program to change the name of the folder back to plugins. So, if you renamed it to plugins-disabled, just change it back to plugins.

Once you do that, you’ll see the full list of all your plugins again. Only now, they’ll all be deactivated:

Reactivate your plugins one by one

Reactivate your plugins one by one

Use the Activate button to reactivate them one-by-one.

Once you find the plugin that’s causing the issue, you can either reach out to the plugin’s developer for help or choose an alternate plugin that accomplishes the same thing (we’ve collected the best WordPress plugins here).

4. Deactivate CDN Temporarily

If you’re getting 403 forbidden errors on your assets (images, JavaScript, CSS), it could be a problem with your content delivery network (CDN). In this case, we recommend temporarily disabling your CDN and then checking your site to see if it works. If you’re a Kinsta client, click into your site and then on the “Kinsta CDN” tab. Once there, toggle the “Kinsta CDN” button off.

Disable Kinsta's CDN

Disable Kinsta’s CDN

5. Check to See If Hotlink Protection Is Misconfigured

Hotlinking is when someone adds an image to their site, but the hosted link is still pointed to someone else’s site. To prevent this, some will set up what is called “hotlink protection” with their WordPress host or CDN provider.

When hotlink protection is enabled, it will typically return a 403 forbidden error. This is normal. However, if you’re seeing a 403 forbidden error on something you shouldn’t be, check to make sure hotlink protection is configured properly.

Still Having Issues? Reach Out to Your Hosting Provider

If none of the above solutions worked for you, then we recommend reaching out to your hosting provider. They can most likely help you pinpoint the issue and get you back up and running. If you’re a Kinsta client, open up a support ticket with our team. We are available 24/7.

Summary

The 403 Forbidden error means that your server is working, but you no longer have permission to view all or some of your site for some reason.

The two most likely causes of this error are issues with your WordPress site’s file permissions or .htaccess file. Beyond that, some plugin issues might also cause the 403 Forbidden error. Or it could be that something is misconfigured with hotlink protection or your CDN.

By following the troubleshooting steps in this guide, you should be able to get your site back to working in no time.


Get all your applications, databases and WordPress sites online and under one roof. Our feature-packed, high-performance cloud platform includes:

  • Easy setup and management in the MyKinsta dashboard
  • 24/7 expert support
  • The best Google Cloud Platform hardware and network, powered by Kubernetes for maximum scalability
  • An enterprise-level Cloudflare integration for speed and security
  • Global audience reach with up to 35 data centers and 275 PoPs worldwide

Test it yourself with $20 off your first month of Application Hosting or Database Hosting. Explore our plans or talk to sales to find your best fit.

I’ve read all the 403-related questions here and elsewhere and I can’t find an answer to this question:
When I try to get a particular image on a remote domain via JavaScript I get a 403 error.
But if I type the same exact image URL in the same browser, the image is downloaded and displayed without errors. Same (success) if I try getting it via PHP.

Here is a fiddle with a live example of the 403 (visible in the debug console): http://jsfiddle.net/8VfrQ/
Then, just copy and paste the img.src link in the browser and you’ll see the star displayed.

Thanks for any hints.

asked Jun 25, 2014 at 10:43

chris's user avatar

3

When I try to get a particular image on a remote domain via JavaScript
I get a 403 error.

Likely answer: The site in question has protection against «leeching» / hotlinking. i.e. It checks to see what host is requesting the file before serving it. If the request comes from an unrecognised website, they throw a 403 Forbidden error.

If you take a look at this updated fiddle you will see that it’s not only JavaScript that is affected.

Simon Hayter's user avatar

Simon Hayter

32.7k7 gold badges57 silver badges116 bronze badges

answered Jun 25, 2014 at 11:47

Wexford's user avatar

WexfordWexford

2,2999 silver badges13 bronze badges

3

The site appears to be checking the referrer field.

curl -I http://mysticstars.net/gifs/star_bul.gif -e "*"
HTTP/1.1 403 Forbidden
Date: Wed, 25 Jun 2014 15:45:40 GMT
Server: Apache/2.2.27
Accept-Ranges: bytes
Vary: Accept-Encoding
Content-Length: 1007
Content-Type: text/html

curl -I http://mysticstars.net/gifs/star_bul.gif -e "http://mysticstars.net"
HTTP/1.1 200 OK
Date: Wed, 25 Jun 2014 15:46:37 GMT
Server: Apache/2.2.27
Last-Modified: Wed, 26 Sep 2007 20:56:22 GMT
ETag: "1a08a9c-e3-43b1016084980"
Accept-Ranges: bytes
Content-Length: 227
Content-Type: image/gif

As @Wayne Whitty points out, this is likely due to rewrite rules preventing hotlinking.

To my knowledge, javascript cannot pass the referrer field, so you may have to amend the hotlink rules.

answered Jun 25, 2014 at 15:49

jeffatrackaid's user avatar

3

Понравилась статья? Поделить с друзьями:

Читайте также:

  • 403 forbidden access is denied iis как исправить
  • 403 error олх
  • 403 error the request could not be satisfied что это
  • 403 error the request could not be satisfied что делать
  • 403 error the request could not be satisfied перевод

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии