Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

NGINX/Apache redirect on 403 and 404

Posted on 2016-10-28
5
Medium Priority
?
367 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 84

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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Introduction People like FTP.  It's a solid, stable, robust protocol for quickly transferring files between two hosts using TCP/IP.  In most cases it's much faster than SMB or CIFS, and certainly much easier to set up between organizations.  This…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

610 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