Solved

NGINX/Apache redirect on 403 and 404

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP Error Settings 12 81
Missing Apache mod_DBD packages in Centos 7 2 78
SQL Query - Issue with Top Statement 5 46
Need To Change Centos 6 Timestamp Form In Log File 24 71
In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Goal:  To set up a secure SSH server for your home computer to make it accessible anywhere AND to use it as a port forwarding proxy. Steps 1.  WinSSHD version 5 is free for personal use.  So download and install it.  You can download it from the…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

810 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