How to solve 302 Found Error

HTTP 302 Found error occur mainly for redirection problem.There might be some sort of server error and for this you being redirected to an error page using 302. First you should check the server logs for errors.

OAuth redirects a user with a 302 redirection error. It show when the authorization server attempting to get a resource that requires auth to access. 

In .htaccess file you can change like bellow. If you have https url, redirect like this

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ https://www.your-domain.com/$1 [R=302]

If you use nginx server, you will find different configuration file. By default you'll find the file as nginx.conf and it's probably located in /usr/local/nginx/conf, /usr/local/etc/nginx or /etc/nginx directories.

server {
    listen 80;
    listen 443 ssl;
    server_name www.youdomain.com;
    rewrite ^/$ http://www.you-domain.com redirect;
}

If you use form to save data in the database and after save redirect those page that content csrt_token. If the page you access by Ajax, redirect you to another page. In that case you would disable the redirection.

When request send by Ajax POST method to the server that can return HTTP response with status 302 found. 

$.ajaxSetup({
 
    headers: {

         'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        	}
                    
    });

Set this code before ajax request($.ajax()).

If you have any further query, comment bellow.

author Author: Robert Calixto

comments Commenting and subscribing are very important to us because they motivate us to keep producing content of the highest caliber that appeals to your needs and interests.