403 error with plesk and wordpress error forbidden - wordpress

i want to link my website to a woocomerce extension called shopmaster
but when insert my link and click on connect im getting this error i have tried everything
Forbidden
You do not have permission to access this document.
Web Server at shopalway.co.za
things i have tried!
making sure my post name is correct
enabled directory browsing
setting file and folder to 755 filezilla
i even created a folder called httacces
clearing coockies
contacting webhost they say nothing is wrong
made sure rest api is enabled
8.deleted all files reinstalled wordpress
even changed the web.config file in code
from false to true hope to let it make a difference
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="true" /> (<---was on false)
<httpErrors>
<remove statusCode="502" subStatusCode="-1" />
<remove statusCode="501" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="412" subStatusCode="-1" />
<remove statusCode="406" subStatusCode="-1" />
<remove statusCode="405" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<remove statusCode="401" subStatusCode="-1" />
<remove statusCode="400" />
<error statusCode="400" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\bad_request.html" />
<remove statusCode="407" />
<error statusCode="407" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\proxy_authentication_required.html" />
<remove statusCode="414" />
<error statusCode="414" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\request-uri_too_long.html" />
<remove statusCode="415" />
<error statusCode="415" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\unsupported_media_type.html" />
<remove statusCode="503" />
<error statusCode="503" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\maintenance.html" />
<error statusCode="401" prefixLanguageFilePath="" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\unauthorized.html" />
<error statusCode="403" prefixLanguageFilePath="" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\forbidden.html" />
<error statusCode="404" prefixLanguageFilePath="" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\not_found.html" />
<error statusCode="405" prefixLanguageFilePath="" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\method_not_allowed.html" />
<error statusCode="406" prefixLanguageFilePath="" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\not_acceptable.html" />
<error statusCode="412" prefixLanguageFilePath="" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\precondition_failed.html" />
<error statusCode="500" prefixLanguageFilePath="" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\internal_server_error.html" />
<error statusCode="501" prefixLanguageFilePath="" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\not_implemented.html" />
<error statusCode="502" prefixLanguageFilePath="" path="E:\Inetpub\vhosts\shopalway.co.za\error_docs\bad_gateway.html" />
</httpErrors>
<rewrite>
<rules>
<rule name="WordPress: https://shopalway.co.za" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule></rules>
</rewrite>
</system.webServer>
</configuration>
i have installed ssl certificate let encrypt recently as well.
using plesk onyx17.8.11
windows shared hosting
img1
<--Click links for image errors
img2
<--Click links for image errors
img3
<--Click links for image errors
img4
<--Click links for image errors

Redirection issue:
https://shopalway.co.za/ is working
but the error is shown onely on http://shopalway.co.za/
* that mean that you have an SSL:
https://www.sslshopper.com/ssl-checker.html#hostname=https://shopalway.co.za/
SOLUTION: Add these lines on the .htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Related

custom httpError is throwing 500 internal server error in WCF service

I am trying to add my custom error handling for http errors that are thrown after requests to my WCF API.
I have added the below in my web.config:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="10000" />
</requestFiltering>
</security>
<httpErrors errorMode="Custom" >
<remove statusCode="404" subStatusCode='-1' />
<error statusCode="404" prefixLanguageFilePath="" path="/GlobalHttpError.aspx" responseMode="ExecuteURL" />
<remove statusCode="401" subStatusCode='-1' />
<error statusCode="401" prefixLanguageFilePath="" path="/GlobalHttpError.aspx" responseMode="ExecuteURL" />
<remove statusCode="501" subStatusCode='-1' />
<error statusCode="501" prefixLanguageFilePath="" path="/GlobalHttpError.aspx" responseMode="ExecuteURL" />
<remove statusCode="411" subStatusCode='-1' />
<error statusCode="411" prefixLanguageFilePath="" path="/GlobalHttpError.aspx" responseMode="ExecuteURL" />
<remove statusCode="403" subStatusCode='-1' />
<error statusCode="403" prefixLanguageFilePath="" path="/GlobalHttpError.aspx" responseMode="ExecuteURL" />
</httpErrors>
I have a method that uploads files so I am trying to generate a custom error page once the file size exceeds the maxAllowedContentLength.
Whenever I add this piece of code to my web.config and I try to test the method from postman I get 500 error:
The page cannot be displayed because an internal server error has occurred.
What is this error and how can I resolve it?
Update
I tried also the below:
<httpErrors errorMode="Custom" >
<remove statusCode="404" subStatusCode='13' />
<error statusCode="404" subStatusCode='13' prefixLanguageFilePath="" path="/GlobalHttpError.aspx" responseMode="ExecuteURL" />
</httpErrors>
But still not working
Even if I add this only:
<httpErrors errorMode="Detailed"></httpErrors>
Also same error is thrown when maxAllowedContentLength is exceeded.

Skip CustomErrors and go to HttpErrors

I have web.config settings like this
<customErrors mode="On" >
<error statusCode="404" redirect="~/404" />
<error statusCode="403" redirect="~/500" />
<error statusCode="500" redirect="~/500" />
</customErrors>
and for httperrors
<httpErrors errorMode="Custom" >
<error statusCode="400" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\bad_request.html" />
<remove statusCode="401" subStatusCode="-1" />
<error statusCode="401" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\unauthorized.html" />
<remove statusCode="403" subStatusCode="-1" />
<error statusCode="403" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\forbidden.html" />
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\not_found.html" /><remove statusCode="405" subStatusCode="-1" />
<error statusCode="405" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\method_not_allowed.html" /><remove statusCode="406" subStatusCode="-1" />
<error statusCode="406" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\not_acceptable.html" />
<error statusCode="407" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\proxy_authentication_required.html" /><remove statusCode="412" subStatusCode="-1" />
<error statusCode="412" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\precondition_failed.html" />
<error statusCode="414" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\request-uri_too_long.html" /><error statusCode="415" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\unsupported_media_type.html" />
<remove statusCode="500" subStatusCode="-1" /><error statusCode="500" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\internal_server_error.html" />
<remove statusCode="501" subStatusCode="-1" /><error statusCode="501" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\not_implemented.html" />
<remove statusCode="502" subStatusCode="-1" /><error statusCode="502" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\bad_gateway.html" />
<error statusCode="503" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\maintenance.html" />
</httpErrors>
On 404 Error. Skipping 404 page and goes to .aspxerrorpath= page.aspx
and writing
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
I want to show my customized 404, 500 error page. What is the wrong
In short, in production it is possible to completely get rid of the "system.web -> customErrors" section, which is almost kept for the compatibility purposes (check the What is the difference between customErrors and httpErrors? thread to learn more), and where you also specify redirects. Then, specify the necessary redirects and custom error pages within the "system.webServer -> httpErrors" section only. Make sure that these HTML files exist on the web server and are available via the relative paths (or these pages exist inside one of a parent web app on the same web server, so that these "errors" settings are inherited).
Solution Explorer:
~/YourWebApp
...
not_found.html
Web.config
Web.config (for the 404 status code error):
<!--Dev: For Visual Studio Mode-->
<system.web>
<customErrors mode="On">
<error statusCode="404" redirect="~/not_found.html" />
</customErrors>
</system.web>
<!--Prod: For IIS Mode-->
<system.webServer>
<httpErrors errorMode="Custom">
<!--<error statusCode="404" path="C:\Inetpub\vhosts\domain.win2012.tld\error_docs\not_found.html" />-->
<error statusCode="404" path="~/not_found.html" responseMode="Redirect" />
</httpErrors>
</system.webServer>

httpErrors not working on localhost in web.config

I have added following in my webconfig. It works when site is hosted to IIS but not when I run locally. It gives me error of wrong web.config.
<system.webServer>
<httpErrors errorMode="Custom" defaultPath="ShowError.aspx" defaultResponseMode="ExecuteURL">
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<remove statusCode="401" subStatusCode="-1" />
<remove statusCode="405" subStatusCode="-1" />
<remove statusCode="406" subStatusCode="-1" />
<remove statusCode="412" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="501" subStatusCode="-1" />
<remove statusCode="502" subStatusCode="-1" />
</httpErrors>
</system.webServer>
The defaultPath attribute is locked by default, which causes the 500.19 error. You can either:
Unlock defaultPath by removing it from your applicationHost.config, which I do not recommend because then you'll have to configure this on every developer and production server.
Remove defaultPath and defaultResponseMode from <httpErrors> and specify path and responseMode on each <error>, like so:
<httpErrors errorMode="Custom">
<clear />
<error statusCode="404" responseMode="ExecuteURL" path="ShowError.aspx" />
<error statusCode="403" responseMode="ExecuteURL" path="ShowError.aspx" />
<error statusCode="401" responseMode="ExecuteURL" path="ShowError.aspx" />
<error statusCode="405" responseMode="ExecuteURL" path="ShowError.aspx" />
<error statusCode="406" responseMode="ExecuteURL" path="ShowError.aspx" />
<error statusCode="412" responseMode="ExecuteURL" path="ShowError.aspx" />
<error statusCode="500" responseMode="ExecuteURL" path="ShowError.aspx" />
<error statusCode="501" responseMode="ExecuteURL" path="ShowError.aspx" />
<error statusCode="502" responseMode="ExecuteURL" path="ShowError.aspx" />
</httpErrors>
It might seem excessive to specify each status code separately, but there is no other way when using httpErrors. I would recommend you to add 400 (Bad Request).
Some side notes:
You can omit subStatusCode="-1" because -1 is the default value of subStatusCode.
If you're going to remove/replace all default IIS error pages, you might as well use <clear />.
You might want to remove errorMode="Custom" when you've got your error pages working, because this will hide error details from developers, slowing down productivity while debugging. A good error page is only returned for remote requests, which is what the default value (errorMode="DetailedLocalOnly") will do.
If you can't get the error pages to work, try responseMode="Replace". You also want to avoid using this in developer environments for the same reasons as the above.
If you have custom error pages, try this:
<system.webServer>
<httpErrors errorMode="DetailedLocalOnly" existingResponse="Auto">
<remove statusCode="403" />
<remove statusCode="404" />
<remove statusCode="500" />
<error statusCode="403" responseMode="ExecuteURL" path="/Error/AccessDenied" />
<error statusCode="404" responseMode="ExecuteURL" path="/Error/NotFound" />
<error statusCode="500" responseMode="ExecuteURL" path="/Error/InternalServerError" />
</httpErrors>
If you want custom error pages on local, you can change DetailedLocalOnly to Custom.

custom 500 error page is classic asp

I'v got this in my web.config file.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="/404.asp" />
<error statusCode="500" redirect="/500.asp" />
</customErrors>
</system.web>
<system.webServer>
<httpErrors errorMode="Custom">
<remove statusCode="404" />
<error statusCode="404" path="/404.asp" responseMode="ExecuteURL" />
<remove statusCode="500" />
<error statusCode="500" path="/500.asp" responseMode="ExecuteURL" />
</httpErrors>
<defaultDocument>
<files>
<add value="home.asp" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
The 404 redirect works fine but the 500 redirect does nothing. I'm completely baffled. Little help. Thanks.
I use the following. Note the subStatusCode
<system.webServer>
<httpErrors>
<error statusCode="500" subStatusCode="100" path="/errorpage500-100.asp" responseMode="ExecuteURL"/>
</httpErrors>
</system.webServer>

IIS 7.5 Custom error pages not working for file with extension

I am facing a starnge issue with one of my server, I've setup the custom error pages however error pages are not showing up when I have file extension in URL for example it does not work for somedomain.com/abcd.aspx or somedomain.com/abcd.aspx, it just show me blank page.
It is working if I dont have file extension in my URL for example http://somedomain.com/abcd works fine.
Following is the configuration setting in web.config file
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL" existingResponse="Replace">
<remove statusCode="502" subStatusCode="-1" />
<remove statusCode="501" subStatusCode="-1" />
<remove statusCode="500" subStatusCode="-1" />
<remove statusCode="412" subStatusCode="-1" />
<remove statusCode="406" subStatusCode="-1" />
<remove statusCode="405" subStatusCode="-1" />
<remove statusCode="404" subStatusCode="-1" />
<remove statusCode="403" subStatusCode="-1" />
<remove statusCode="401" subStatusCode="-1" />
<error statusCode="401" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="403" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="404" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="405" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="406" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="412" prefixLanguageFilePath="" path="/Error/Error400.aspx" responseMode="ExecuteURL" />
<error statusCode="500" prefixLanguageFilePath="" path="/Error/Error500.aspx" responseMode="ExecuteURL" />
<error statusCode="501" prefixLanguageFilePath="" path="/Error/Error500.aspx" responseMode="ExecuteURL" />
<error statusCode="502" prefixLanguageFilePath="" path="/Error/Error500.aspx" responseMode="ExecuteURL" />
</httpErrors>
Any help or pointers will be great.
Regards,
Sameer
I'm sure you've already solved this by now, but for others searching for the answer, I ran into this same issue today and was able to solve it by adding a customError handler in addition to the httpErrors.
Change:
<system.web>
<customErrors mode="Off" />
to:
<system.web>
<customErrors mode="RemoteOnly">
<error redirect="/Errors/404" statusCode="404" />
</customErrors>

Resources