Go Daddy 403 page - .htaccess

I tried to block an ip in the .htaccess, which I could do but I can't get the default 403 error to redirect to my custom 403 page. Anyone know how to do this?
ErrorDocument 403 /403/403.html

You might be denying access to the file when you block the IP in the .htaccess file.
Create another .htaccess file inside the 403 directory and in that .htaccess allow all from anyone. Then anyone should be able to see the custom 403.html page when they are blocked.
See if that will help your issue.
Update:
Here is an example.
Put the error document line in the root .htaccess file.
ErrorDocument 403 /403/403.html
Then in the .htaccess file inside the 403 directory add only this.
Order allow,deny
Allow from all

Browser Cache? http://pcsupport.about.com/od/browsers/f/clear-cache.htm
HTTP-Server restart (I don't know how it works by GoDaddy)
Is it the right path to the Error-HTML file? /403/403.html (try the absolute path?)

I figured it out
ErrorDocument 403 /error/403.html
order allow,deny
deny from xxx.xxx.xxx.xx
allow from all

Related

How to deny all access to a directory and redirect 403?

I have a folder on my webserver and want to deny all access to that folder and all the files in it. Additionally, the visitor must be redirected to a specific error page on the same server.
The secured folder path is:
https://www.mywebsite.com/some_folder/files
The error page is located here:
https://www.mywebsite.com/some_folder/error.php
I tried placing a .htaccess file in the 'files' folder. This does prevent visitors from accessing the folder and files, but the redirect does not take place. I suspect that the syntax of the relative path is not correct.
This is my .htaccess:
ErrorDocument 403 /../error.php
Order deny,allow
Deny from all
When hitting the secured folder URL, the browser gives me this error message: "A 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."
Does someone have an example of what my .htacces should be?
You may try this in some_folder/.htaccess:
RewriteEngine On
RewriteEngine !^error\.php$ error.php [L,NC]
This will rewrite all requests that start with /some_folder/ to some_folder/error.php though browser won't see status code 403.
Inside error.php you may use this php code to return 403:
http_response_code(403);

htacces, Redirect on deny

i'd like to make a redirect after a deny - because now, it's shows the apache Startpage.
My htaccess-code:
ErrorDocument 403 /forbidden.php
Deny from .ru
Deny from .cn
unfortunately it doesn't work, why?
thanks
thomas
This is only working if Apache can geht the DN of the client by double reverse lookup. If the reverse lookup has no result your rule will not work and the client gets access. You see, that this is not very reliable and you should switch to GEOIP.
If the deny rule is working and the desired page does not show, remember that the location is relative to the document root. So if your forbidden.php in subfolder /test you will need to set the rule like this:
ErrorDocument 403 /test/forbidden.php
Deny from .ru
Deny from .cn
Even if .htaccess and forbidden.php are in /test subfolder.

How to keep certain files exempt from .htaccess redirect?

I have one website (www.mysite.com) that I have on a temporary redirect to another folder (www.mysite.com/tempfolder/index.php). I also host another site in the root folder of www.mysite.com called www.subsite.com. It has it's own URL, but I can't figure out how to make that entire sub-folder exempt from the redirect! Any ideas? Here is what my .htaccess file looks like right now (which is perfectly redirecting everything to the temporary landing page).
<Limit GET POST PUT>
order deny,allow
deny from all
allow from ***
allow from ****
allow from *****
</LIMIT>
ErrorDocument 403 http://www.mysite.com.com/tempfolder/index.php
<filesMatch ".(htm|html|php|css|js|php|gif|jpg|db|png)$">
order allow,deny
allow from all
</FilesMatch>
Any ideas? thanks all!
try putting an .htaccess file in the subfolder that does not contain the redirection rules. That should work just fine -- it can even be a blank file.

404 custom error template .htaccess

Ok, I have a problem, my .htaccess code is:
RewriteEngine on
ErrorDocument 404 /notfound.html
and I have not found.html near .htaccess.
Why is it not working? I don't believe what I'm seeing. I took the tutorial from here
http://www.htaccessbasics.com/404-custom-error-page/
I just want that every time I access www.site.com/ajfasoijfiajsfijaofij to show what is it in notfound.html.
when using ErrorDocument , the file you're specifying is relative to DOCUMENT ROOT not .htaccess location!
Edit:
assume you have notfound.html and you want to use it for folder dir01, you create an htaccess file inside this folder and add this:
ErrorDocument 404 /dir01/notfound.html
If you want to access your file(notfound.html) in browser it would be http://www.example.com/dir01/notfound.html. that's all I could explain!
You can use in your .htaccess file the following code:
RewriteBase /

404 errors being redirected to the homepage instead of custom 404 page

I have a site hosted on an Apache server. I have created some custom error pages and the following text at the top of my .htaccess file:
ErrorDocument 404 404.html
ErrorDocument 500 500.html
ErrorDocument 401 401.html
I have also tried,
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html
ErrorDocument 401 /401.html
Both the htaccess file and the custom pages are in the root directory of the server.
The problem is that when I enter a garbage url (where I would expect to see my custom 404 page) I'm simply being redirected to my index page.
Try if your server is properly set up to parse and process .htaccess files in the first place (i.e., check if AllowOverride + AccessFileName directives are correct). For example, write some stuff in that you know will work and look if it actually gets executed (like a ridiculous rewrite rule). Also, look up your httpd log files for errors.
If it does get executed properly, the problem might be that your server is setup not to allow all kinds of overrides with .htaccess files. Your syntax however, is basically correct.

Resources