• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 436
  • Last Modified:

NGINX/Apache redirect on 403 and 404

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
tf2012
Asked:
tf2012
  • 3
  • 2
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
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
 
tf2012Author Commented:
it seems to process .htaccess for some reason so I'll give this a shot today.  Thanks!
0
 
tf2012Author Commented:
@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
 
Dave BaldwinFixer of ProblemsCommented:
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
 
tf2012Author Commented:
great idea thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now