Non http pages are redirecting to home page (Nginx)Nginx vhost config issueMoved from http to https but include www in url302 redirect issues. Page header shows 302 for all pagesMagento 1.9.2.4, HTTP to HTTPS, all pages are ok, except home page500 Internal Server Error nginx/1.12.0 on checkout page after Migration from Apache to NginxNew install on EC2 rewrite issuesMagento 2 on https (SSL certificate)HTTPS 301 redirecting to http versionMagento 2 with Varnish sometimes does not redirect HTTP to HTTPS

Detecting if an element is found inside a container

Avoiding estate tax by giving multiple gifts

Applicability of Single Responsibility Principle

How to pronounce the slash sign

A Rare Riley Riddle

Anatomically Correct Strange Women In Ponds Distributing Swords

Term for the "extreme-extension" version of a straw man fallacy?

Would this custom Sorcerer variant that can only learn any verbal-component-only spell be unbalanced?

Why escape if the_content isnt?

What happens if you roll doubles 3 times then land on "Go to jail?"

Is there a good way to store credentials outside of a password manager?

How do I extract a value from a time formatted value in excel?

How does Loki do this?

Do sorcerers' Subtle Spells require a skill check to be unseen?

What is the difference between "behavior" and "behaviour"?

Roman Numeral Treatment of Suspensions

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Return the Closest Prime Number

How did Doctor Strange see the winning outcome in Avengers: Infinity War?

Short story about space worker geeks who zone out by 'listening' to radiation from stars

Is it appropriate to ask a job candidate if we can record their interview?

How does buying out courses with grant money work?

Purchasing a ticket for someone else in another country?

How do scammers retract money, while you can’t?



Non http pages are redirecting to home page (Nginx)


Nginx vhost config issueMoved from http to https but include www in url302 redirect issues. Page header shows 302 for all pagesMagento 1.9.2.4, HTTP to HTTPS, all pages are ok, except home page500 Internal Server Error nginx/1.12.0 on checkout page after Migration from Apache to NginxNew install on EC2 rewrite issuesMagento 2 on https (SSL certificate)HTTPS 301 redirecting to http versionMagento 2 with Varnish sometimes does not redirect HTTP to HTTPS













0















I would like all my pages for http to redirect to the same location as https



for example



http://www.domain.com/somepage/ now redirects to https://www.domain.com



I would like it to redirect to https://www.domain.com/somepage/



When I applied the rule



return 301 https://$server_name$request_uri;


EDIT:



Adding the header of file



#enter preformatted text here`rackspacedigital.com

server {

listen 80;
listen 443 ssl;


Do I need to separate out the listen to two server blocks?










share|improve this question
















bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.



















    0















    I would like all my pages for http to redirect to the same location as https



    for example



    http://www.domain.com/somepage/ now redirects to https://www.domain.com



    I would like it to redirect to https://www.domain.com/somepage/



    When I applied the rule



    return 301 https://$server_name$request_uri;


    EDIT:



    Adding the header of file



    #enter preformatted text here`rackspacedigital.com

    server {

    listen 80;
    listen 443 ssl;


    Do I need to separate out the listen to two server blocks?










    share|improve this question
















    bumped to the homepage by Community yesterday


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      0












      0








      0








      I would like all my pages for http to redirect to the same location as https



      for example



      http://www.domain.com/somepage/ now redirects to https://www.domain.com



      I would like it to redirect to https://www.domain.com/somepage/



      When I applied the rule



      return 301 https://$server_name$request_uri;


      EDIT:



      Adding the header of file



      #enter preformatted text here`rackspacedigital.com

      server {

      listen 80;
      listen 443 ssl;


      Do I need to separate out the listen to two server blocks?










      share|improve this question
















      I would like all my pages for http to redirect to the same location as https



      for example



      http://www.domain.com/somepage/ now redirects to https://www.domain.com



      I would like it to redirect to https://www.domain.com/somepage/



      When I applied the rule



      return 301 https://$server_name$request_uri;


      EDIT:



      Adding the header of file



      #enter preformatted text here`rackspacedigital.com

      server {

      listen 80;
      listen 443 ssl;


      Do I need to separate out the listen to two server blocks?







      nginx https 301-redirect






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '15 at 16:30







      brentwpeterson

















      asked Nov 23 '15 at 15:38









      brentwpetersonbrentwpeterson

      4,32653475




      4,32653475





      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          2 Answers
          2






          active

          oldest

          votes


















          0














          Copy file app/code/core/Mage/Core/Controller/Varien/Front.php to app/code/local/Mage/Core/Controller/Varien/Front.php


          Modify method protected function _checkBaseUrl($request) from



          protected function _checkBaseUrl($request)
          isset($uri['path']) && strpos($requestUri, $uri['path']) === false
          )
          Mage::app()->getFrontController()->getResponse()
          ->setRedirect($baseUrl, $redirectCode)
          ->sendResponse();
          exit;






          to



          protected function _checkBaseUrl($request)
          strtolower($request->getMethod()) == 'post')
          return;


          $redirectCode = (int)Mage::getStoreConfig('web/url/redirect_to_base');
          if (!$redirectCode)
          return;
          elseif ($redirectCode != 301)
          $redirectCode = 302;


          if ($this->_isAdminFrontNameMatched($request))
          return;


          $baseUrl = Mage::getBaseUrl(
          Mage_Core_Model_Store::URL_TYPE_WEB,
          Mage::app()->getStore()->isCurrentlySecure()
          );
          if (!$baseUrl)
          return;


          $uri = @parse_url($baseUrl);
          $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
          $newUrl = rtrim($baseUrl, '/') . $requestUri; // PD-April-170
          if (isset($uri['scheme']) && $uri['scheme'] != $request->getScheme()





          Under system->configuration->web->Url Options , set the flag Auto-redirect to Base URL to Yes.






          share|improve this answer






























            0














            set unsecure base url to https://
            and also maybe a problem with Redirect to base url in magento web settings, set to "no".



            i hope your config looks like this?



            server 
            listen 80;
            server_name domain.com;
            return 301 https://$server_name$request_uri;


            server
            listen 443 ssl;
            server_name domain.com;



            https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security

            add this in nginx add_header Strict-Transport-Security "max-age=31536000"; in .php$ location or http block.



            check headers if it works in either location
            https://chrome.google.com/webstore/detail/http-headers/mhbpoeinkhpajikalhfpjjafpfgjnmgk?utm_source=chrome-app-launcher-info-dialog






            share|improve this answer

























            • Where do I add the "add_header" call?

              – brentwpeterson
              Nov 23 '15 at 16:26











            • updated answer .

              – MagenX
              Nov 23 '15 at 17:06










            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f91257%2fnon-http-pages-are-redirecting-to-home-page-nginx%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Copy file app/code/core/Mage/Core/Controller/Varien/Front.php to app/code/local/Mage/Core/Controller/Varien/Front.php


            Modify method protected function _checkBaseUrl($request) from



            protected function _checkBaseUrl($request)
            isset($uri['path']) && strpos($requestUri, $uri['path']) === false
            )
            Mage::app()->getFrontController()->getResponse()
            ->setRedirect($baseUrl, $redirectCode)
            ->sendResponse();
            exit;






            to



            protected function _checkBaseUrl($request)
            strtolower($request->getMethod()) == 'post')
            return;


            $redirectCode = (int)Mage::getStoreConfig('web/url/redirect_to_base');
            if (!$redirectCode)
            return;
            elseif ($redirectCode != 301)
            $redirectCode = 302;


            if ($this->_isAdminFrontNameMatched($request))
            return;


            $baseUrl = Mage::getBaseUrl(
            Mage_Core_Model_Store::URL_TYPE_WEB,
            Mage::app()->getStore()->isCurrentlySecure()
            );
            if (!$baseUrl)
            return;


            $uri = @parse_url($baseUrl);
            $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
            $newUrl = rtrim($baseUrl, '/') . $requestUri; // PD-April-170
            if (isset($uri['scheme']) && $uri['scheme'] != $request->getScheme()





            Under system->configuration->web->Url Options , set the flag Auto-redirect to Base URL to Yes.






            share|improve this answer



























              0














              Copy file app/code/core/Mage/Core/Controller/Varien/Front.php to app/code/local/Mage/Core/Controller/Varien/Front.php


              Modify method protected function _checkBaseUrl($request) from



              protected function _checkBaseUrl($request)
              isset($uri['path']) && strpos($requestUri, $uri['path']) === false
              )
              Mage::app()->getFrontController()->getResponse()
              ->setRedirect($baseUrl, $redirectCode)
              ->sendResponse();
              exit;






              to



              protected function _checkBaseUrl($request)
              strtolower($request->getMethod()) == 'post')
              return;


              $redirectCode = (int)Mage::getStoreConfig('web/url/redirect_to_base');
              if (!$redirectCode)
              return;
              elseif ($redirectCode != 301)
              $redirectCode = 302;


              if ($this->_isAdminFrontNameMatched($request))
              return;


              $baseUrl = Mage::getBaseUrl(
              Mage_Core_Model_Store::URL_TYPE_WEB,
              Mage::app()->getStore()->isCurrentlySecure()
              );
              if (!$baseUrl)
              return;


              $uri = @parse_url($baseUrl);
              $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
              $newUrl = rtrim($baseUrl, '/') . $requestUri; // PD-April-170
              if (isset($uri['scheme']) && $uri['scheme'] != $request->getScheme()





              Under system->configuration->web->Url Options , set the flag Auto-redirect to Base URL to Yes.






              share|improve this answer

























                0












                0








                0







                Copy file app/code/core/Mage/Core/Controller/Varien/Front.php to app/code/local/Mage/Core/Controller/Varien/Front.php


                Modify method protected function _checkBaseUrl($request) from



                protected function _checkBaseUrl($request)
                isset($uri['path']) && strpos($requestUri, $uri['path']) === false
                )
                Mage::app()->getFrontController()->getResponse()
                ->setRedirect($baseUrl, $redirectCode)
                ->sendResponse();
                exit;






                to



                protected function _checkBaseUrl($request)
                strtolower($request->getMethod()) == 'post')
                return;


                $redirectCode = (int)Mage::getStoreConfig('web/url/redirect_to_base');
                if (!$redirectCode)
                return;
                elseif ($redirectCode != 301)
                $redirectCode = 302;


                if ($this->_isAdminFrontNameMatched($request))
                return;


                $baseUrl = Mage::getBaseUrl(
                Mage_Core_Model_Store::URL_TYPE_WEB,
                Mage::app()->getStore()->isCurrentlySecure()
                );
                if (!$baseUrl)
                return;


                $uri = @parse_url($baseUrl);
                $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
                $newUrl = rtrim($baseUrl, '/') . $requestUri; // PD-April-170
                if (isset($uri['scheme']) && $uri['scheme'] != $request->getScheme()





                Under system->configuration->web->Url Options , set the flag Auto-redirect to Base URL to Yes.






                share|improve this answer













                Copy file app/code/core/Mage/Core/Controller/Varien/Front.php to app/code/local/Mage/Core/Controller/Varien/Front.php


                Modify method protected function _checkBaseUrl($request) from



                protected function _checkBaseUrl($request)
                isset($uri['path']) && strpos($requestUri, $uri['path']) === false
                )
                Mage::app()->getFrontController()->getResponse()
                ->setRedirect($baseUrl, $redirectCode)
                ->sendResponse();
                exit;






                to



                protected function _checkBaseUrl($request)
                strtolower($request->getMethod()) == 'post')
                return;


                $redirectCode = (int)Mage::getStoreConfig('web/url/redirect_to_base');
                if (!$redirectCode)
                return;
                elseif ($redirectCode != 301)
                $redirectCode = 302;


                if ($this->_isAdminFrontNameMatched($request))
                return;


                $baseUrl = Mage::getBaseUrl(
                Mage_Core_Model_Store::URL_TYPE_WEB,
                Mage::app()->getStore()->isCurrentlySecure()
                );
                if (!$baseUrl)
                return;


                $uri = @parse_url($baseUrl);
                $requestUri = $request->getRequestUri() ? $request->getRequestUri() : '/';
                $newUrl = rtrim($baseUrl, '/') . $requestUri; // PD-April-170
                if (isset($uri['scheme']) && $uri['scheme'] != $request->getScheme()





                Under system->configuration->web->Url Options , set the flag Auto-redirect to Base URL to Yes.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 23 '15 at 16:46









                Anshu MishraAnshu Mishra

                5,52452661




                5,52452661























                    0














                    set unsecure base url to https://
                    and also maybe a problem with Redirect to base url in magento web settings, set to "no".



                    i hope your config looks like this?



                    server 
                    listen 80;
                    server_name domain.com;
                    return 301 https://$server_name$request_uri;


                    server
                    listen 443 ssl;
                    server_name domain.com;



                    https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security

                    add this in nginx add_header Strict-Transport-Security "max-age=31536000"; in .php$ location or http block.



                    check headers if it works in either location
                    https://chrome.google.com/webstore/detail/http-headers/mhbpoeinkhpajikalhfpjjafpfgjnmgk?utm_source=chrome-app-launcher-info-dialog






                    share|improve this answer

























                    • Where do I add the "add_header" call?

                      – brentwpeterson
                      Nov 23 '15 at 16:26











                    • updated answer .

                      – MagenX
                      Nov 23 '15 at 17:06















                    0














                    set unsecure base url to https://
                    and also maybe a problem with Redirect to base url in magento web settings, set to "no".



                    i hope your config looks like this?



                    server 
                    listen 80;
                    server_name domain.com;
                    return 301 https://$server_name$request_uri;


                    server
                    listen 443 ssl;
                    server_name domain.com;



                    https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security

                    add this in nginx add_header Strict-Transport-Security "max-age=31536000"; in .php$ location or http block.



                    check headers if it works in either location
                    https://chrome.google.com/webstore/detail/http-headers/mhbpoeinkhpajikalhfpjjafpfgjnmgk?utm_source=chrome-app-launcher-info-dialog






                    share|improve this answer

























                    • Where do I add the "add_header" call?

                      – brentwpeterson
                      Nov 23 '15 at 16:26











                    • updated answer .

                      – MagenX
                      Nov 23 '15 at 17:06













                    0












                    0








                    0







                    set unsecure base url to https://
                    and also maybe a problem with Redirect to base url in magento web settings, set to "no".



                    i hope your config looks like this?



                    server 
                    listen 80;
                    server_name domain.com;
                    return 301 https://$server_name$request_uri;


                    server
                    listen 443 ssl;
                    server_name domain.com;



                    https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security

                    add this in nginx add_header Strict-Transport-Security "max-age=31536000"; in .php$ location or http block.



                    check headers if it works in either location
                    https://chrome.google.com/webstore/detail/http-headers/mhbpoeinkhpajikalhfpjjafpfgjnmgk?utm_source=chrome-app-launcher-info-dialog






                    share|improve this answer















                    set unsecure base url to https://
                    and also maybe a problem with Redirect to base url in magento web settings, set to "no".



                    i hope your config looks like this?



                    server 
                    listen 80;
                    server_name domain.com;
                    return 301 https://$server_name$request_uri;


                    server
                    listen 443 ssl;
                    server_name domain.com;



                    https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security

                    add this in nginx add_header Strict-Transport-Security "max-age=31536000"; in .php$ location or http block.



                    check headers if it works in either location
                    https://chrome.google.com/webstore/detail/http-headers/mhbpoeinkhpajikalhfpjjafpfgjnmgk?utm_source=chrome-app-launcher-info-dialog







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Nov 23 '15 at 17:07

























                    answered Nov 23 '15 at 16:16









                    MagenXMagenX

                    2,0701024




                    2,0701024












                    • Where do I add the "add_header" call?

                      – brentwpeterson
                      Nov 23 '15 at 16:26











                    • updated answer .

                      – MagenX
                      Nov 23 '15 at 17:06

















                    • Where do I add the "add_header" call?

                      – brentwpeterson
                      Nov 23 '15 at 16:26











                    • updated answer .

                      – MagenX
                      Nov 23 '15 at 17:06
















                    Where do I add the "add_header" call?

                    – brentwpeterson
                    Nov 23 '15 at 16:26





                    Where do I add the "add_header" call?

                    – brentwpeterson
                    Nov 23 '15 at 16:26













                    updated answer .

                    – MagenX
                    Nov 23 '15 at 17:06





                    updated answer .

                    – MagenX
                    Nov 23 '15 at 17:06

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f91257%2fnon-http-pages-are-redirecting-to-home-page-nginx%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Sum ergo cogito? 1 nng

                    三茅街道4182Guuntc Dn precexpngmageondP