is it possible to send 2 http status codes for 404 error page and redirect to homepage [duplicate]





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0
















This question is an exact duplicate of:




  • Redirecting 404 [Not Found] Error To Homepage And Before Redirecting To Home Page, Tell Search Engines 404 Page is Gone[410] Using .htaccess

    1 answer




in .htaccess file, is it possible to send 410 status code for 404 error page and then immediately redirect to homepage?



for example, when search engine crawl a 404 page, server send 410 status code and then redirect to homepage.










share|improve this question















marked as duplicate by Yvette Colomb Dec 2 '18 at 3:18


This question was marked as an exact duplicate of an existing question.



















  • Don't post duplicate questions.

    – Yvette Colomb
    Dec 2 '18 at 3:18


















0
















This question is an exact duplicate of:




  • Redirecting 404 [Not Found] Error To Homepage And Before Redirecting To Home Page, Tell Search Engines 404 Page is Gone[410] Using .htaccess

    1 answer




in .htaccess file, is it possible to send 410 status code for 404 error page and then immediately redirect to homepage?



for example, when search engine crawl a 404 page, server send 410 status code and then redirect to homepage.










share|improve this question















marked as duplicate by Yvette Colomb Dec 2 '18 at 3:18


This question was marked as an exact duplicate of an existing question.



















  • Don't post duplicate questions.

    – Yvette Colomb
    Dec 2 '18 at 3:18














0












0








0









This question is an exact duplicate of:




  • Redirecting 404 [Not Found] Error To Homepage And Before Redirecting To Home Page, Tell Search Engines 404 Page is Gone[410] Using .htaccess

    1 answer




in .htaccess file, is it possible to send 410 status code for 404 error page and then immediately redirect to homepage?



for example, when search engine crawl a 404 page, server send 410 status code and then redirect to homepage.










share|improve this question

















This question is an exact duplicate of:




  • Redirecting 404 [Not Found] Error To Homepage And Before Redirecting To Home Page, Tell Search Engines 404 Page is Gone[410] Using .htaccess

    1 answer




in .htaccess file, is it possible to send 410 status code for 404 error page and then immediately redirect to homepage?



for example, when search engine crawl a 404 page, server send 410 status code and then redirect to homepage.





This question is an exact duplicate of:




  • Redirecting 404 [Not Found] Error To Homepage And Before Redirecting To Home Page, Tell Search Engines 404 Page is Gone[410] Using .htaccess

    1 answer








.htaccess http-status-code-404 http-status-code-410






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 19 '18 at 14:02







Gul Noor

















asked Nov 25 '18 at 7:03









Gul NoorGul Noor

104




104




marked as duplicate by Yvette Colomb Dec 2 '18 at 3:18


This question was marked as an exact duplicate of an existing question.









marked as duplicate by Yvette Colomb Dec 2 '18 at 3:18


This question was marked as an exact duplicate of an existing question.















  • Don't post duplicate questions.

    – Yvette Colomb
    Dec 2 '18 at 3:18



















  • Don't post duplicate questions.

    – Yvette Colomb
    Dec 2 '18 at 3:18

















Don't post duplicate questions.

– Yvette Colomb
Dec 2 '18 at 3:18





Don't post duplicate questions.

– Yvette Colomb
Dec 2 '18 at 3:18












1 Answer
1






active

oldest

votes


















0














No, it is not possible to send a 4xx and redirect (ie. 3xx status) in the same response - if that is the intention.



A 410 (or 404) response is one response. A 3xx HTTP redirect is another entirely different response. You do one or the other, not both.



Google will likely see 3xx redirects to the home page as soft-404s anyway (as they are generally a bad user experience).



However, you can send a 410 "Gone" status instead of a 404 "Not Found". Exactly how you do this will depend on your system. For example, if you have an existing 404 document then it may be easier to simply override the HTTP status when the response is sent to the client. To send a 410 when any response does not map to a physical file or directory then you can do something like the following using mod_rewrite in .htaccess:



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ - [G]





share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    No, it is not possible to send a 4xx and redirect (ie. 3xx status) in the same response - if that is the intention.



    A 410 (or 404) response is one response. A 3xx HTTP redirect is another entirely different response. You do one or the other, not both.



    Google will likely see 3xx redirects to the home page as soft-404s anyway (as they are generally a bad user experience).



    However, you can send a 410 "Gone" status instead of a 404 "Not Found". Exactly how you do this will depend on your system. For example, if you have an existing 404 document then it may be easier to simply override the HTTP status when the response is sent to the client. To send a 410 when any response does not map to a physical file or directory then you can do something like the following using mod_rewrite in .htaccess:



    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ - [G]





    share|improve this answer




























      0














      No, it is not possible to send a 4xx and redirect (ie. 3xx status) in the same response - if that is the intention.



      A 410 (or 404) response is one response. A 3xx HTTP redirect is another entirely different response. You do one or the other, not both.



      Google will likely see 3xx redirects to the home page as soft-404s anyway (as they are generally a bad user experience).



      However, you can send a 410 "Gone" status instead of a 404 "Not Found". Exactly how you do this will depend on your system. For example, if you have an existing 404 document then it may be easier to simply override the HTTP status when the response is sent to the client. To send a 410 when any response does not map to a physical file or directory then you can do something like the following using mod_rewrite in .htaccess:



      RewriteEngine On
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^ - [G]





      share|improve this answer


























        0












        0








        0







        No, it is not possible to send a 4xx and redirect (ie. 3xx status) in the same response - if that is the intention.



        A 410 (or 404) response is one response. A 3xx HTTP redirect is another entirely different response. You do one or the other, not both.



        Google will likely see 3xx redirects to the home page as soft-404s anyway (as they are generally a bad user experience).



        However, you can send a 410 "Gone" status instead of a 404 "Not Found". Exactly how you do this will depend on your system. For example, if you have an existing 404 document then it may be easier to simply override the HTTP status when the response is sent to the client. To send a 410 when any response does not map to a physical file or directory then you can do something like the following using mod_rewrite in .htaccess:



        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^ - [G]





        share|improve this answer













        No, it is not possible to send a 4xx and redirect (ie. 3xx status) in the same response - if that is the intention.



        A 410 (or 404) response is one response. A 3xx HTTP redirect is another entirely different response. You do one or the other, not both.



        Google will likely see 3xx redirects to the home page as soft-404s anyway (as they are generally a bad user experience).



        However, you can send a 410 "Gone" status instead of a 404 "Not Found". Exactly how you do this will depend on your system. For example, if you have an existing 404 document then it may be easier to simply override the HTTP status when the response is sent to the client. To send a 410 when any response does not map to a physical file or directory then you can do something like the following using mod_rewrite in .htaccess:



        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^ - [G]






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 25 '18 at 23:23









        MrWhiteMrWhite

        13k33262




        13k33262

















            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()