403 ошибка htaccess

I found a problem with the earlier example, which was:

ErrorDocument 403 /notfound.html

I have a directory on my site storing images, say at domain.com/images

I wanted that if someone tries accessing the directory’s URL that they be redirected to the site’s homepage. My problem was, with the above, that the URL in the browser would remain domain.com/images and then the homepage would load, but the homepage would reference stylesheets that it could not access from that URL. (And it makes sense — 403 is supposed to show an error message).

I then tried researching how to redirect a 403 error to another URL and a few sites said you can’t do a 302 or 301 — you’re missing the point: 403 is an error, not a redirect.

But I found a way. This is the .htaccess file inside the /images directory:

Options -Indexes
ErrorDocument 403 /images/403.php
RewriteEngine on
RewriteRule ^403.php$ /index.php [R=301]

So basically the first line prevents directory listing.

The second line says that for «permission denied» (ie. 403 error, which is what the first line gives), the site should load the file «/images/403.php». But you don’t actually need to create any 403.php file in that directory, because…

The third line turns on your redirect engine

And the fourth line says that if the user attempts to load the page 403.php (ie. in this «/images» directory where this .htaccess file is located) then they should be redirected, using a 301 (permanent) redirect, to /index.php — which is the index of the root directory (ie the homepage), and not the index of the /images subdirectory (and indeed there is no index in «/images» anyway).

Hence — how to get a 403 to redirect to another URL using a 301 (permanent) redirect (or, you could try a 302 temporary redirect too).

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.

В статье мы расскажем, что такое ошибка 403 (403 forbidden) и как ее исправить.

  • Ошибка 403: что она значит
  • Хостинг заблокирован
  • Некорректное название главной страницы
  • Файлы загружены вне корневой директории
  • Некорректные настройки в файле .htaccess
  • Некорректная работа плагинов
  • Как устранить ошибку 403 forbidden, если описанные способы не помогли
  • Что делать, если ошибка 403 forbidden запрещает доступ к стороннему ресурсу

Ошибка 403: что она значит

Ошибки вида 4хх относятся к категории ошибок клиента (браузера) — когда сервер отправил ответ на запрос, но браузер не может его обработать.

Код 403 (forbidden) значит, что доступ к этому ресурсу запрещен. Текст ошибки может отличаться, например:

  • error 403,
  • 403 запрещено,
  • HTTP 403,
  • Forbidden 403,
  • Access denied (перевод на русский: доступ запрещен),
  • Error: access denied и др.

Ниже мы опишем наиболее распространенные причины возникновения этой ошибки.

Хостинг заблокирован

Хостинг может быть заблокирован по следующим причинам:

  • Нехватка средств на балансе услуги. Пополните баланс хостинга, чтобы сайт продолжал работать.
  • Нарушение правил договора. В этом случае перед блокировкой отправляется уведомление на контактный email услуги: если вы получили это письмо, необходимо устранить нарушение в течение 24 часов.

Некорректное название главной страницы

Главная страница (или индексный файл) — это страница, которая открывается первой при переходе по домену. По умолчанию индексный файл в панели управления SpaceWeb называется index.html или index.php. Ошибка 403 (forbidden) означает, что файл отсутствует или его название отличается.

Чтобы исправить название файла:

  1. Перейдите в панель управления.
  2. Разверните блок Хостинг и выберите Сайты:

  1. Затем справа от имени пользователя кликните Открыть папку:

  1. Перейдите в корневую директорию сайта. Нажмите на иконку индексного файла и выберите Переименовать:

  1. Укажите название файла.

Если файл стартовой страницы отсутствует, выполните шаги 1, 2 и 3. Затем перейдите в корневую папку сайта и кликните Загрузить файлы:

Файлы загружены вне корневой директории

Ошибка 403 на сайте может возникать, если файлы не загружены в корневую директорию: например, файлы находятся в подпапке или выше на один уровень.
Чтобы это проверить:

  1. Перейдите в панель управления.
  2. Разверните блок Хостинг и выберите Сайты:

  1. Затем справа от имени пользователя кликните Открыть папку:

  1. Перейдите в корневую директорию сайта и проверьте наличие файлов:

Некорректные настройки в файле .htaccess

Иногда причина ошибки с кодом 403 — некорректные правила в файле .htaccess. Чтобы убедиться в том, что проблема в директивах .htaccess, измените название файла. После этого проверьте, осталась ли ошибка на сайте.

Для решения проблемы обратитесь к разработчику сайта. Зачастую она связана с правилами «RewriteRule» или путаницей с действиями «deny» и «allow».

 
Некорректная работа плагинов

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

Как устранить ошибку 403 forbidden, если описанные способы не помогли

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

Что делать, если ошибка 403 forbidden запрещает доступ к стороннему ресурсу

Как исправить ошибку 403 (доступ запрещен), если вы перешли на сторонний ресурс:
Проверьте корректность URL. Иногда ошибка может возникнуть, когда вы обращаетесь к подразделу: например, при вводе в адресной строке test.ru/contacts возникает ошибка. Но если указать test.ru/contacts/ (со знаком / в конце), страница открывается корректно.

  • Проверьте, не закрыт ли доступ намеренно. Например, руководство предприятия может закрыть доступ с рабочих компьютеров ко всем ресурсам, кроме корпоративных.
  • Обновите страницу или зайдите позже. Высока вероятность, что владелец сайта знает о проблеме и занимается ее решением.
  • Возможно, сайт закрыт в определенном регионе. При подключении к интернету вашему устройству присваивается IP-адрес. IP содержит информацию о регионе, и на ее основе администратор может ограничить доступ к определенной странице или сайту целиком. Для решения проблемы можно использовать VPN или прокси-сервер.
  • Очистите кеш и cookies браузера. Это может быть полезно, если ранее не было проблем с доступом к сайтам.
  • Обратитесь к интернет-провайдеру. Если перечисленные способы не помогли исправить ошибку, обратитесь в поддержку поставщика интернет-услуг: возможно, провайдер попал в черный список — из-за этого могут быть проблемы с доступом к сайтам.
     

The 403 error is used to identify web pages or resources that cannot be accessed. However, it may happen that the 403 Forbidden error pops up when it shouldn’t and this can be frustrating regardless of whether the error is occurring on your site, or if it happens on the page you are trying to visit.

In this article, the 403 error: how to solve it, we are going to look at the reason for the 403 error and the various ways it can occur. We will then see how to get around the error if you are a user trying to browse a page or if the problem is occurring on your site.

The 403 error: how to solve it – what does it mean?

Error 403 is part of the HTTP 4XX status codes, also referred to as client-side errors. This category also includes one of the most common errors you may come across while browsing: the 404 error. The 404 error or 404 not found is used to indicate that the requested page or resource could not be found. As opposed to client errors there are server errors such as the error 500, 502 bad gateway and 504 gateway time-out.

The 403 Forbidden error occurs when you do not have permission to access the page or resource you are trying to open. There are two main instances where the 403 error can occur.

403 Error Access Forbidden

In the first case, you are trying to access a resource for which you don’t really have permission, for example, a section of the site accessible only to registered users.

In the second case, instead, you are trying to reach a page that should be accessible, but the website owner has not correctly configured the permissions, so you get a 403 error.

Besides these two cases, there are other causes that can lead to a 403 error, which we will see in the following paragraphs.

As it happens with other error pages (for example the error 500 or 404), error 403 can be customized. Moreover, it is possible that the 403 error presents itself in different variations, let’s see which are the main ones.

403 Error Forbidden

Variations of error 403

Error 403 can be found in different forms, the most common ones are:

  • Error 403 can be found in different forms, the most common ones are:
  • Error 403
  • Error 403 Forbidden
  • Error 403 Access Denied
  • HTTP ERROR 403
  • HTTP Error 403 Forbidden
  • 403 Forbidden – nginx
  • Forbidden
  • You are not authorized to view this page
  • Forbidden: You don’t have permission to access [directory/file] on this server
  • It appears you don’t have permission to access this page
  • HTTP Error 403 – Forbidden – You do not have permission to access the document or program you requested
  • Access Denied – You don’t have permission to access
  • Access to [domain name] was denied. You don’t have the authorization to view this page.
403 Error Forbidden Nginx
Example of error 403 Forbidden – nginx

What causes error code 403

In this section, we will see what are all the possible causes of error 403. In the next paragraphs, instead, we are going to see how to solve error 403 from site visitors and how to remove the error 403 on your site.

Directory listing denied

When you try to access a folder on your site from your browser that does not contain a default document, the web server may return a 403 Forbidden error. In particular, this occurs when there is no default document (such as index.php or index.html) and at the same time Directory listings have been blocked.

Directory listing (or directory index) is deactivated precisely to avoid that trying to reach an address for which there is no default file is displayed. This option is disabled for security reasons, if you have a site with SupportHost the option is already deactivated. Alternatively, to understand how to disable it, you can follow the steps outlined in our WordPress security guide.

File or folder permissions configuration error

Error 403 can also be caused if the site’s file and folder permissions settings are not set correctly. File and folder permissions allow you to specify which users can interact with files and how.

403 Error File And Folders

Permissions pertain to the ability to read, write, and execute files and are indicated by a 3-digit number, each for each action (read, write, and execute). When we talk about how to get rid of the 403 error, we’ll see how to go about changing the permissions of files and folders.

Corrupt .htaccess file

In Apache servers, the 403 Forbidden error can be due to an error in the .htaccess file. The .htaccess file is used for several reasons including protecting access to files and folders and creating redirects (such as 301 redirects).

In the section on how to fix the 403 Forbidden error, we will see how to regenerate the .htaccess file with WordPress.

Unauthorized user

Sites that require an authentication typically display a 401 Unauthorized error warning. However, in some cases, it is possible for the webserver to show a 403 error.

Plugin incompatibility

Another cause of the 403 error can be a problem with a plugin or lack of compatibility between different plugins on your WordPress site.

In this case, you should disable all plugins and check if the error persists. If the 403 error does not appear after deactivating the plugins, you’ll have to reactivate them one by one to figure out which one is causing the problem.

In the next paragraphs, we will see how to identify the problematic plugins.

CDN problems

Some CDNs like CloudFlare allow you to set up a firewall and block traffic based on location, IP address or other parameters. If the request sent to the server is not within the rules set in the firewall you may receive a 403 error in response.

To check if the error is caused by the CDN itself, try disabling it temporarily and see if the 403 error continues to appear.

In the paragraph on troubleshooting we will see how to disable the CDN to see if it is causing the problem.

Hotlink Protection

Hotlink protection is a measure to prevent hotlinking. Hotlinking occurs when someone places an image on your site using the address of an image hosted on another site. In this way, the image will be displayed on the target site, but it will use the resources of the site that is hosting it.

To avoid this situation you can enable hotlink protection. When the hotlink protection is enabled, if it is not set correctly it can lead to the appearance of a 403 Forbidden error. In this case, you should check that the hotlink protection is configured correctly.

Cause of Error 403 on IIS

On Microsoft IIS (Internet Information Services) servers, HTTP error codes are accompanied by additional numeric codes that allow you to get more details about the causes of the error. You can find the complete list in the Microsoft documentation.

For example, in the case of errors on file and/or folder permissions you may encounter one of these three errors depending on the type of problem (read, write or execute):

  • 403.1 – Execute access forbidden
  • 403.2 – Read access forbidden
  • 403.3 – Write access forbidden.

On ISS servers you may also get a 403 error if there are too many simultaneous connections (403.9 – Too many users).

Troubleshooting 403 error: how to fix it as a user

If the error code 403 occurs on the site you are visiting you can try different ways.

Update the page

It may seem like the most trivial thing, but if you haven’t already, the first thing you should do is try to refresh the page. You can click on the reload page button in your browser or press the F5 key on your keyboard.

403 Error Reload Page

Sometimes the 403 error may occur due to a technical problem and be only temporary, so you may hope to resolve it by simply reloading the page.

In addition to simply refreshing the page, you can also have the browser reload the page ignoring the cache. To do this, just press Ctrl+F5 on Windows or Shift+CMD+R on Mac.

Check the address

Another thing to do is to make sure that the address you are trying to visit does not contain any errors. Make sure you typed it correctly or that there are no errors, for example, you may have followed a link with an error in the address.

In this case, try to reach the destination page in another way. For example, you could link to the site’s homepage and use the site’s search function to find the content you were interested in reaching.

Clear cache and cookies

Clearing the cache and cookies of the browser you are using can help you in case the error is occurring on only one device or browser.

403 Error Clear Cache Chrome

If you’ve tried to reach the address from another device or with a different browser and only encounter the 403 error with a particular browser you can follow our guide to figuring out how to clear cache and cookies on major browsers.

Disable VPN

VPNs are used to ensure privacy and mask IP addresses. However, not all sites allow access using a VPN. In this case, if you are getting a 403 error and you are using a VPN you can try disabling it and see if it resolves the error.

Contact the site owner

Another thing you can do is try to contact the site owners directly. In this way you can report the 403 error and check if your IP address has been blocked.

See the cache copy of the site

If none of the previous methods helped you to solve the 403 error, there is still another solution you can try to be able to see the page on which the error occurs.

Search engines like Google or Bing allow you to access the cache copy of web pages. To view the Google cache of a page you just need to do a search on Google and then click on the down arrow you see next to the address. Here’s how to do that using the example you see in this screenshot.

403 Error Check Google Cache

Alternatively, if you can’t see the cached copy of the site this way, you can also use the Wayback Machine.

Just connect to the site and type in the address of the page you want to view. After that, check if there are any copies of the page stored and click on one of the available dates to see the cached version stored on that date.

403 Error Wayback Machine Supporthost

The 403 error: how to solve it and fix it on your site

In this section, we will see what you can do to fix the 403 Forbidden error, on your site based on the causes we listed earlier.

We will then see how to:

  • modify the file and folder permissions
  • restore the htaccess file, generating a new one
  • check if the error 403 is due to a plugin.

Also remember that you should make sure that the problem does not depend on CDN or hotlink protection, as we saw before.

Change file and folder permissions

As we have seen the 403 error can occur if the file and folder permissions are not set correctly.

The following file and folder permissions should be set for WordPress files and folders:

  • 644 or 640 for files
  • 755 or 750 for folders.

This is an exception to the wp-config.php file which should be set to 440 or 400.

You can verify that the permissions are set correctly in two ways: by using the file manager to access files and folders on your site or by using an FTP client such as FileZilla.

Use the cPanel file manager

Log in to cPanel and click on File Manager to access the file manager.

IMAGE

In the Permissions column, you will see the file and folder permissions.

IMAGE

To change them just select a file or folder and click on Permissions as you see in this screenshot.

IMAGE

Then change the permissions and click on Change Permissions to save. In this example, we see how to set permissions for the file wp-config.php.

403 Error Set Permissions WordPress Wp Config

Usare FileZilla

You can check the file and folder permissions using an FTP client like FileZilla. First, you have to connect to the server with FileZilla, the data to be entered are host, username, password and port.

403 Error Filezilla Quick Connection

If you have activated a plan with SupportHost such as a WordPress hosting or a dedicated solution like a dedicated server or VPS cloud hosting, you just need to use the login details you find in the activation email.

You can also create a new FTP account with cPanel.

After logging in browse to the file or folder for which you want to change the permissions, right-click on the file and click on File Permissions as you see here in this example.

403 Error Filezilla File Permissions

Change the read, write and execute settings and click OK.

403 Error Change Filezilla Permissions

In the case of folders, instead of having to change permissions for all subfolders and files within them, you can choose to apply them automatically. To do so, right-click on the top folder and click on File Permissions.

403 Error Filezilla Permission For All Files And Directories

After setting the new permissions check the Include subfolders box and you can choose to:

  • apply permissions to all files and folders
  • apply only to files
  • apply only to folders.

Regenerate htaccess file

The 403 Forbidden error can be caused by a problem in the .htaccess file, the best solution is to have WordPress regenerate the file in order to eliminate the error. Before proceeding, however, you need to create a backup copy of your current .htaccess file. To do this you need to access your site’s files, you can do this by using the control panel’s file manager or accessing the server via FTP, for example with FileZilla.

In this example, we will see how to do it with the cPanel file manager. Login to cPanel and click on File Manager.

Cpanel File Manager 403 Error

The .htaccess file is located at the root of the site, but in case you don’t see it, make sure that the option to show hidden files is enabled.

Click on the settings and check the Show hidden files (dotfiles) box as you see in this screenshot and click on Save.

403 Error Show Hidden Files In Cpanel

Locate the .htaccess file and download a copy onto your computer, simply right click on the file and then click on Download.

403 Error Backup Copy File Htaccess

After that, you can delete the .htaccess file, right-click on the file and then click Delete.

403 Error Delete Htaccess File

Login to your WordPress site dashboard and click on Settings → Permalink.

403 Error Permalink Settings

Scroll to the bottom of the page and click Save Changes, doing so will automatically generate a new .htaccess file for WordPress.

403 Error WordPress Permalink Save Changes

Deactivate and reactivate plugins

A recently installed WordPress plugin or an incompatibility issue between different plugins on your site can cause a 403 error. To figure out if a plugin is the cause of the error you’ll need to temporarily deactivate them, let’s see how to do that with two different methods.

If you can access the WordPress dashboard you can deactivate plugins directly from there, otherwise, you’ll have to proceed in a different way, which we’ll see in a moment.

Disable plugins from the dashboard

To deactivate plugins from the dashboard login to your WordPress site and click on the Plugins tab. From this section first, you need to check the box next to Plugins to select all of them.

403 Error Select All WordPress Plugins

After that from the Bulk Actions menu, click on the Deactivate item and then click on the Apply button.

403 Error Deactivate WordPress Plugins

This will deactivate all plugins.

Deactivate plugins by connecting to the server

If you can’t access the dashboard of your site, you’ll have to directly access the files hosted on the server. As we have seen before to delete the .htaccess file or change file permissions you could do it either from the file manager of your site’s control panel, for example from cPanel, or through an FTP client like FileZilla.

In this example, we will see how to do it with the file manager, but the procedure to follow is quite similar.

The folder we are interested in is the one where the plugins are contained, which in turn is located inside the wp-content folder. The full path will usually be /public_html/wp-content/plugins.

To deactivate all plugins we just need to rename the folder, for example in “deactivated plugins”, as you see in this screenshot.

403 Error Reneme WordPress Plugin Folder

Reactivate plugins

After deactivating the plugins, connect to the site again and check if the error 403 still appears. If the error does not appear anymore, then the cause is one of the plugins that were active on your site.

At this point you just need to figure out which plugin is causing the problem and to do that you need to reactivate the plugins one by one, checking each time if the 403 error reappears.

If you have deactivated the plugins from the dashboard, you only need to activate them manually one by one. If you renamed the plugins folder, you’ll have to change the name back to “plugins”. Then you can activate the plugins from the dashboard.

To activate plugins, login to WordPress, click on the Plugins tab and then click on Activate under the name of the plugin as you see in this screenshot.

403 Error Activate Plugin

Once you have identified the plugin causing the problem what can you do? First of all, check if the plugin is up to date and if not, update it. In case the error continues to appear after updating the plugin you can try to contact the developer and ask for assistance.

Otherwise, the only thing to do is to replace the plugin with one that has the same function.

Disable CDN

The causes for error 403 may also include a problem with the CDN (content distribution network). To rule this out, we can disable the CDN by changing the nameservers and setting the default ones from the hosting.

If you are our customer, you will need to make sure you are using our nameservers:

  • ns.supporthost.com
  • ns.supporthost.eu
  • ns.supporthost.net
  • ns.supporthost.us

All you have to do is go to the nameserver management section from the customer area and select the option Use default nameservers as shown here:

Use Supporthost Default Nameservers

If you have any doubts, follow the detailed procedure described in our tutorial on nameservers.

Contact support

If you couldn’t solve the 403 error with the methods we’ve seen, you can contact your provider for assistance. If you are a SupportHost customer, you can open a ticket and one of our operators will guide you.

403 Error Open Support Ticket

Conclusion

As we have seen in this article, the 403 error: how to solve it, the 403 forbidden error is displayed when you do not have the necessary permissions to access the requested page. In most cases, the error is caused by incorrect configuration of file or folder permissions or a problem with the .htaccess file.

We have seen how to bypass the 403 error code from user and how to get rid of 403 error if it occurs on your site. Did the error show up on your site as well? How did you solve it and if so with which method? Let me know in the comments below.

Вы столкнулись с сообщением «Ошибка 403»? Что делать, мы расскажем в этой статье.

Если при открытии вашего сайта вы получили одно из следующих уведомлений:

  • В доступе на страницу отказано,
  • 403 Forbidden,
  • Forbidden, доступ запрещён,
  • Forbidden You don’t have permission to access,
  • Access denied.

Ошибка 403 говорит о том, что доступ к запрашиваемой странице запрещён или у пользователя нет прав на просмотр контента.

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

Возможные причины и их решения, если проблема на стороне владельца сайта

Заблокирована работа хостинга

403 ошибка может возникнуть, если услуга хостинга была заблокирована. Блокировка может произойти, если превышены технические ограничения тарифа или нарушены условия договора оферты. Перед блокировкой на контактный email владельца услуги придёт предупреждение. У него будет 24 часа на устранение причины блокировки.

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

Если подобных писем не приходило и услуга не блокировалась, причина ошибки в другом.

Некорректно задана главная страница сайта

Главная страница сайта (индексный файл) – это первая страница, которая открывается пользователю, если он перешёл по домену без указания точной страницы сайта, например www.test.ru. По общепринятым правилам она называется index.html или index.php. Если в корневой папке сайта отсутствует файл с названием index.html или index.php, возникнет ошибка 403. В качестве индексного файла может использоваться файл, отличный от index.html или index.php. Но название данного файла должно быть указано в настройках.

Проверьте, чтобы:

  • в корневой папке сайта существовал файл главной страницы (индексный файл),
  • в настройках указано соответствующее название файла главной страницы (индексного файла).

Чтобы это проверить войдите в панель управления хостингом и следуйте соответствующей инструкции ниже:

Как проверить, какое название файла главной страницы указано в настройках

  1. 1.

    В левом меню перейдите на страницу Сайты.

  2. 2.

    Выберите домен, на котором возникает ошибка 403, и нажмите кнопку Изменить.

  3. 3.

    В пункте «Индексная страница» в поле ввода должно быть указано название файла главной страницы сайта. По умолчанию index.php index.html.



    14022022-oshibka-403-1.png

Если название файла главной страницы, который расположен в корневой папке сайта, не соответствует названию, указанному в настройках, измените на правильное и нажмите Ок.

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

  1. 1.

    В левом меню перейдите на страницу Сайты.

  2. 2.

    Выберите домен, на котором возникает ошибка 403, и нажмите кнопку Файлы сайта. Откроется корневая папка вашего сайта.

  3. 3.

    Убедитесь, что в данной папке существует индексный файл, название которого указано в настройках домена:



    14022022-oshibka-403-2.png

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

Как проверить, какое название файла главной страницы указано в настройках

Для панели управления CPanel название индексного файла установлено по умолчанию index.html и index.php. Изменить его можно только вручную, через файл .htaccess. Поэтому в случае с cPanel необходимо убедиться только в том, что в корневой папке сайта существует файл index.html или index.php.

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

Обратите внимание: если вид вашей панели управления отличается от представленного в статье, в разделе «Основная информация» переключите тему с paper_lantern на jupiter.

  1. 1.

    В разделе «Домены» перейдите на страницу Домены:




  2. 2.

    Нажмите по строке, где указана корневая папка домена, на котором возникает ошибка 403. Откроется корневая папка вашего сайта:




  3. 3.

    Убедитесь, что в данной папке существует индексный файл, название которого указано в настройках домена.




Если индексный файл index.html или index.php существует в корневой папке сайта, но 403 ошибка сохраняется, переходите к следующим действиям.

Как проверить, какое название файла главной страницы указано в настройках

Для панели управления Plesk название индексного файла установлено по умолчанию index.html и index.php. Изменить его можно только вручную, через файл .htaccess. Поэтому в случае с панелью Plesk необходимо убедиться только в том, что в корневой папке сайта существует файл index.html или index.php.

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

  1. 1.

    Под нужным доменом нажмите по строке, где указана корневая папка домена. Откроется корневая папка вашего сайта.

  2. 2.

    Убедитесь, что в данной папке существует индексный файл, название которого указано в настройках домена.




Если индексный файл index.html или index.php существует в корневой папке сайта, но 403 ошибка сохраняется, то переходите к следующим действиям.

Установлены некорректные права на файлы и каталоги сайта

В большинстве случаев корректными правами для каталогов являются «755», а для файлов «644». Проверьте и измените права на файлы и папки.

Если все права доступа к файлам и папкам указаны корректно, перейдите к следующему шагу.

Файлы сайта находятся не в корневой директории

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

Чтобы узнать корневую директорию и проверить, загружены ли в неё файлы сайта, выберите свою панель и следуйте соответствующей инструкции:

  1. 1.

    В левом меню перейдите на страницу Сайты.

  2. 2.

    Выберите домен, на котором возникает ошибка 403, и нажмите кнопку Файлы сайта.

  3. 3.

    Откроется корневая папка вашего сайта. Убедитесь, что файлы сайта загружены в эту папку, а не в подпапку.



    14022022-oshibka-403-3.png

При отсутствии файлов сайта в корневой папке, добавьте их по инструкции Как разместить сайт на хостинге. Если ошибка 403 сохраняется, то переходите к следующему шагу.

Обратите внимание: если вид вашей панели управления отличается от представленного в статье, в разделе «Основная информация» переключите тему с paper_lantern на jupiter.

  1. 1.

    В разделе «Домены» перейдите на страницу Домены:




  2. 2.

    Нажмите по строке, где указана корневая папка домена, на котором возникает ошибка 403. Откроется корневая папка вашего сайта:




  3. 3.

    Убедитесь, что файлы сайта загружены в эту папку, а не в подпапку.




При отсутствии файлов сайта в корневой папке, добавьте их по инструкции Как разместить сайт на хостинге. Если ошибка 403 сохраняется, то переходите к следующему шагу.

  1. 1.

    Под нужным доменом нажмите по строке, где указана корневая папка домена. Откроется корневая папка вашего сайта.

  2. 2.

    Убедитесь, что файлы сайта загружены в эту папку, а не в подпапку.




При отсутствии файлов сайта в корневой папке, добавьте их по инструкции Как разместить сайт на хостинге. Если ошибка 403 сохраняется, то переходите к следующему шагу.

Неправильно настроен файл .htaccess (только для хостинга Linux)

Проверьте правила в конфигурационном файле .htaccess. Попробуйте временно изменить имя файла .htaccess, например, на .htaccess_old, и проверьте работоспособность сайта.

Если сайт станет доступен или на нём будет отображаться другая ошибка (не 403), дело в некорректных правилах или директивах, заданных в .htaccess.

Чтобы поправить, обратитесь к разработчикам сайта. Как правило, проблемы связаны с условиями «deny from all» и «RewriteRule».

Если вы используете на своём сайте CMS (например, WordPress, Bitrix и т.п.), вам может помочь замена существующего файла .htaccess на стандартный для вашей CMS.

Если после изменения названия файла .htaccess ошибка 403 не пропала, переходите к следующим действиям.

Некорректная версия ASP.NET (только для хостинга для ASP.NET)

Ошибка может возникнуть, если ваш сайт написан для версии ASP.NET 4.x, а на услуге хостинга установлен ASP.NET 3.5. Чтобы изменить версию ASP.NET для услуги хостинга, оставьте заявку в службу поддержки.

Некорректная работа плагинов в WordPress

Если ваш сайт сделан на WordPress, нужно проверить, не мешают ли работе сайта плагины.

Сначала обновите все плагины до последней версии. Иногда устаревшие версии работают некорректно и могут появляться различные ошибки.



Обновить плагин в WordPress

После обновления проверьте, работает ли сайт. Если нет, отключите плагины. Если это помогло, значит, один из них нарушает работу веб-ресурса. Отключайте плагины по очереди, пока не найдете плагин-виновник.

Что может сделать пользователь со своей стороны

  1. Проверьте правильность написания URL. Возможно, адрес был введён неверно, поэтому браузер выдал ошибку. Также обратите внимание, что вы вводите адрес веб-страницы или файла, а не каталога. Обычный URL-адрес заканчивается на .com, .ru .php, .html. URL-адрес каталога обычно заканчивается символом «/».
  2. Убедитесь, что у вас действительно есть доступ к этому сайту. Некоторые корпоративные сайты ограничивают виды пользователей, которые могут посещать сервис или для просмотра нужно вводить корпоративный VPN.
  3. Обновите страницу или зайдите позже. Если проблема на стороне владельца сайта, подождите, когда он устранит неполадку.
  4. Очистите кэш и cookies браузера. Это может быть эффективно, если ранее вы заходили на сайт без проблем.
  5. Сайт ограничен для пользователей определённого региона. Каждому устройству, который работает с интернетом присвоен IP-адрес, который содержит информацию о регионе, где пользуются устройством. Если вы пытаетесь зайти на сайт, который можно просматривать только в определенном месте, появляется ошибка 403. Для решения этой проблемы можно использовать прокси-сервер или VPN.
  6. Если вы уверены, что сайт работает у других пользователей и вы попробовали все вышеперечисленные способы, обратитесь к интернет-провайдеру. Поставщик интернета мог попасть в чёрный список, что привело к ошибке 403 Forbidden на страницах одного или нескольких сайтов.

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

Не пропустите эти материалы по теме:

  • Яндекс еда ошибка привязки карты
  • 403 forbidden что значит эта ошибка
  • 403 forbidden как устранить ошибку
  • 40274 ошибка опель астра h расшифровка
  • 40272 ошибка опель астра h расшифровка

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

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