301 Issues with 2 URLs on same webspace











up vote
1
down vote

favorite












I have 2 domains, the old domain is mjvandco.co.uk and he wants this redirecting to mjvlaw.co.uk. I have both pointing to the same webspace but when I test the URLs using https://httpstatus.io/ I get different results.



I have the following in my htaccess along with other stuff, but this is the redirect content:



RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.mjvlaw.co.uk
RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]


# Remove .html (excluding blog)
RewriteCond %{REQUEST_URI} !^/blog(.*)$
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /.*.html HTTP/
RewriteRule ^(.*).html$ /$1 [R=301,L]


The only URL that now is not right is this one: http://www.mjvlaw.co.uk/. I used this site



https://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
http://www.mjvlaw.co.uk - not work as does not go to https
https://www.mjvlaw.co.uk - fine


However, when I do the same for the old domain it all works as it should and every one below goes too https://www.mjvlaw.co.uk.

https://www.mjvandco.co.uk
https://mjvandco.co.uk
http://mjvandco.co.uk
http://www.mjvandco.co.uk


Am I doing something stupid here? Should I create another webspace and have one folder for the old domain and what for the current one and each having it's own htaccess file?


Thanks. I have done another ticket a month or so back but I am not sure how to change the questions, so I apologise for the similar ticket.










share|improve this question


























    up vote
    1
    down vote

    favorite












    I have 2 domains, the old domain is mjvandco.co.uk and he wants this redirecting to mjvlaw.co.uk. I have both pointing to the same webspace but when I test the URLs using https://httpstatus.io/ I get different results.



    I have the following in my htaccess along with other stuff, but this is the redirect content:



    RewriteEngine on
    RewriteCond %{HTTP_HOST} !^www.mjvlaw.co.uk
    RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]


    # Remove .html (excluding blog)
    RewriteCond %{REQUEST_URI} !^/blog(.*)$
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /.*.html HTTP/
    RewriteRule ^(.*).html$ /$1 [R=301,L]


    The only URL that now is not right is this one: http://www.mjvlaw.co.uk/. I used this site



    https://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
    http://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
    http://www.mjvlaw.co.uk - not work as does not go to https
    https://www.mjvlaw.co.uk - fine


    However, when I do the same for the old domain it all works as it should and every one below goes too https://www.mjvlaw.co.uk.

    https://www.mjvandco.co.uk
    https://mjvandco.co.uk
    http://mjvandco.co.uk
    http://www.mjvandco.co.uk


    Am I doing something stupid here? Should I create another webspace and have one folder for the old domain and what for the current one and each having it's own htaccess file?


    Thanks. I have done another ticket a month or so back but I am not sure how to change the questions, so I apologise for the similar ticket.










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have 2 domains, the old domain is mjvandco.co.uk and he wants this redirecting to mjvlaw.co.uk. I have both pointing to the same webspace but when I test the URLs using https://httpstatus.io/ I get different results.



      I have the following in my htaccess along with other stuff, but this is the redirect content:



      RewriteEngine on
      RewriteCond %{HTTP_HOST} !^www.mjvlaw.co.uk
      RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]


      # Remove .html (excluding blog)
      RewriteCond %{REQUEST_URI} !^/blog(.*)$
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /.*.html HTTP/
      RewriteRule ^(.*).html$ /$1 [R=301,L]


      The only URL that now is not right is this one: http://www.mjvlaw.co.uk/. I used this site



      https://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
      http://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
      http://www.mjvlaw.co.uk - not work as does not go to https
      https://www.mjvlaw.co.uk - fine


      However, when I do the same for the old domain it all works as it should and every one below goes too https://www.mjvlaw.co.uk.

      https://www.mjvandco.co.uk
      https://mjvandco.co.uk
      http://mjvandco.co.uk
      http://www.mjvandco.co.uk


      Am I doing something stupid here? Should I create another webspace and have one folder for the old domain and what for the current one and each having it's own htaccess file?


      Thanks. I have done another ticket a month or so back but I am not sure how to change the questions, so I apologise for the similar ticket.










      share|improve this question













      I have 2 domains, the old domain is mjvandco.co.uk and he wants this redirecting to mjvlaw.co.uk. I have both pointing to the same webspace but when I test the URLs using https://httpstatus.io/ I get different results.



      I have the following in my htaccess along with other stuff, but this is the redirect content:



      RewriteEngine on
      RewriteCond %{HTTP_HOST} !^www.mjvlaw.co.uk
      RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]


      # Remove .html (excluding blog)
      RewriteCond %{REQUEST_URI} !^/blog(.*)$
      RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /.*.html HTTP/
      RewriteRule ^(.*).html$ /$1 [R=301,L]


      The only URL that now is not right is this one: http://www.mjvlaw.co.uk/. I used this site



      https://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
      http://mjvlaw.co.uk - goes to https://www.mjvlaw.co.uk
      http://www.mjvlaw.co.uk - not work as does not go to https
      https://www.mjvlaw.co.uk - fine


      However, when I do the same for the old domain it all works as it should and every one below goes too https://www.mjvlaw.co.uk.

      https://www.mjvandco.co.uk
      https://mjvandco.co.uk
      http://mjvandco.co.uk
      http://www.mjvandco.co.uk


      Am I doing something stupid here? Should I create another webspace and have one folder for the old domain and what for the current one and each having it's own htaccess file?


      Thanks. I have done another ticket a month or so back but I am not sure how to change the questions, so I apologise for the similar ticket.







      apache .htaccess redirect






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 13:05









      ChrisD

      175




      175
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          You rule only redirects non-www http URLs to SSL version of your site. To redirect both non-www and www http versions , replace your first rewrite block with the following



          RewriteCond ℅{HTTPS} off [OR]
          RewriteCond %{HTTP_HOST} !^www.mjvlaw.co.uk
          RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]


          Make sure to clear your browser cache before you test this.






          share|improve this answer





















          • this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
            – ChrisD
            Nov 11 at 11:15










          • @ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the ℅{HTTPS} variable. Try replacing the first condition with RewriteCond ℅{REQUEST_SCHEME} http$ [OR]
            – starkeen
            Nov 11 at 14:13












          • unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
            – ChrisD
            Nov 11 at 18:37











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fstackoverflow.com%2fquestions%2f53239243%2f301-issues-with-2-urls-on-same-webspace%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          You rule only redirects non-www http URLs to SSL version of your site. To redirect both non-www and www http versions , replace your first rewrite block with the following



          RewriteCond ℅{HTTPS} off [OR]
          RewriteCond %{HTTP_HOST} !^www.mjvlaw.co.uk
          RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]


          Make sure to clear your browser cache before you test this.






          share|improve this answer





















          • this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
            – ChrisD
            Nov 11 at 11:15










          • @ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the ℅{HTTPS} variable. Try replacing the first condition with RewriteCond ℅{REQUEST_SCHEME} http$ [OR]
            – starkeen
            Nov 11 at 14:13












          • unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
            – ChrisD
            Nov 11 at 18:37















          up vote
          0
          down vote













          You rule only redirects non-www http URLs to SSL version of your site. To redirect both non-www and www http versions , replace your first rewrite block with the following



          RewriteCond ℅{HTTPS} off [OR]
          RewriteCond %{HTTP_HOST} !^www.mjvlaw.co.uk
          RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]


          Make sure to clear your browser cache before you test this.






          share|improve this answer





















          • this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
            – ChrisD
            Nov 11 at 11:15










          • @ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the ℅{HTTPS} variable. Try replacing the first condition with RewriteCond ℅{REQUEST_SCHEME} http$ [OR]
            – starkeen
            Nov 11 at 14:13












          • unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
            – ChrisD
            Nov 11 at 18:37













          up vote
          0
          down vote










          up vote
          0
          down vote









          You rule only redirects non-www http URLs to SSL version of your site. To redirect both non-www and www http versions , replace your first rewrite block with the following



          RewriteCond ℅{HTTPS} off [OR]
          RewriteCond %{HTTP_HOST} !^www.mjvlaw.co.uk
          RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]


          Make sure to clear your browser cache before you test this.






          share|improve this answer












          You rule only redirects non-www http URLs to SSL version of your site. To redirect both non-www and www http versions , replace your first rewrite block with the following



          RewriteCond ℅{HTTPS} off [OR]
          RewriteCond %{HTTP_HOST} !^www.mjvlaw.co.uk
          RewriteRule (.*) https://www.mjvlaw.co.uk/$1 [R=301,L]


          Make sure to clear your browser cache before you test this.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 10 at 14:14









          starkeen

          29.8k145777




          29.8k145777












          • this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
            – ChrisD
            Nov 11 at 11:15










          • @ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the ℅{HTTPS} variable. Try replacing the first condition with RewriteCond ℅{REQUEST_SCHEME} http$ [OR]
            – starkeen
            Nov 11 at 14:13












          • unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
            – ChrisD
            Nov 11 at 18:37


















          • this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
            – ChrisD
            Nov 11 at 11:15










          • @ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the ℅{HTTPS} variable. Try replacing the first condition with RewriteCond ℅{REQUEST_SCHEME} http$ [OR]
            – starkeen
            Nov 11 at 14:13












          • unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
            – ChrisD
            Nov 11 at 18:37
















          this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
          – ChrisD
          Nov 11 at 11:15




          this is still not redirecting to the https version after checking on that site. Is it working for you? mjvlaw.co.uk
          – ChrisD
          Nov 11 at 11:15












          @ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the ℅{HTTPS} variable. Try replacing the first condition with RewriteCond ℅{REQUEST_SCHEME} http$ [OR]
          – starkeen
          Nov 11 at 14:13






          @ChrisD maybe you are behind a proxy server. Proxy server doesnt recognize the ℅{HTTPS} variable. Try replacing the first condition with RewriteCond ℅{REQUEST_SCHEME} http$ [OR]
          – starkeen
          Nov 11 at 14:13














          unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
          – ChrisD
          Nov 11 at 18:37




          unfortunately, that has not worked. Very strange how it works on one of the domains but not the domain that is the main one. If you are not sure after that change do not worry.
          – ChrisD
          Nov 11 at 18:37


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • 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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2fstackoverflow.com%2fquestions%2f53239243%2f301-issues-with-2-urls-on-same-webspace%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







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()