Solved

NGINX/Apache redirect on 403 and 404

Posted on 2016-10-28
5
68 Views
Last Modified: 2016-11-05
Any idea how to redirect to home page on 403 & 404 errors in NGINX with Apache?  PHP-FPM is enabled but seems to still follow apache directives if that makes difference.
0
Comment
Question by:tf2012
  • 3
  • 2
5 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41864109
Make an error page that does it.  This is in my .htaccess page for Apache.  I don't know what nginx requires.
ErrorDocument 400 /400.html
ErrorDocument 401 /401.html
ErrorDocument 403 /403.html
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html

Open in new window

1
 
LVL 1

Author Comment

by:tf2012
ID: 41866743
it seems to process .htaccess for some reason so I'll give this a shot today.  Thanks!
0
 
LVL 1

Author Comment

by:tf2012
ID: 41872603
@Dave what if I want to redirect the 403 to another domain? How would you do that in htaccess?

for example I'm blocking certain ip addresses, the get 403 error, great.. but I want them to redirect to www.mydomain.com for example instead of getting the 403 error.
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 41872820
Just do the redirect in the 403 error page.  You can make it say whatever you want.  They don't have to know they got there because of an error.
0
 
LVL 1

Author Closing Comment

by:tf2012
ID: 41875711
great idea thanks
0

Featured Post

Want to promote your upcoming event?

Are you going to an event? Are you going to be exhibiting at a tradeshow? Talking at a conference? Using a promotional banner in your email signature ensures that your organization’s most important contacts stay in the know and can potentially spread the word about the event.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Samba is the de-facto standard program (or, more correctly: suite of programs) that UNIX and Linux systems use to share files with Microsoft Windows (and more recently, Mac OS-X) systems. Currently, there are 2 common versions of Samba available,…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now