Solved

NGINX/Apache redirect on 403 and 404

Posted on 2016-10-28
5
224 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 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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

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…
Preface There are many applications where some computing systems need have their system clocks running synchronized within a small margin and eventually need to be in sync with the global time. There are different solutions for this, i.e. the W3…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

717 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