Announcement

Collapse
No announcement yet.

Redirect non-www to www with new URI Management or .htaccess?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Redirect non-www to www with new URI Management or .htaccess?

    I am using Miva 9.00052 with URI management and want to redirect non-www to www . Previously I have done this by added a rewrite line in my .htaccess file. Will this method still work? If so, should the code be added before or after the Miva URI rewrite rules?
    Highly caffeinated
    http://www.coffeehouseexpress.com

    #2
    That will still work and should be the first thing in the file so the subsequent request that is analyzed for short links, etc. is already using the hostname you want it to be on:

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www.coffeehouseexpress.com$ [NC]
    RewriteRule ^(.*)$ http://www.coffeehouseexpress.com/$1 [R=301,L]
    Last edited by ILoveHostasaurus; 01-19-16, 11:39 AM.
    David Hubbard
    CIO
    Miva
    [email protected]
    http://www.miva.com

    Comment


      #3
      Same procedure and add it just under this line:

      RewriteEngine on


      Andreas Toman
      PCINET, LLC

      Miva Merchant Design, Development, Integration & Support
      We built over 200 Miva Merchant stores!
      Miva shopping cart design & integration service and see our Portfolio!


      e-mail: [email protected]
      web: www.pcinet.com
      LinkedIn: Andreas Toman
      phone: (786) 250-2056 (Miami, FL)

      Comment


        #4
        Originally posted by ILoveHostasaurus View Post
        That will still work and should be the first thing in the file so the subsequent request that is analyzed for short links, etc. is already using the hostname you want it to be on:

        Code:
        RewriteEngine On
        RewriteCond %{HTTP_HOST} !^www.coffeehouseexpress.com$ [NC]
        RewriteRule ^(.*)$ http://www.coffeehouseexpress.com/$1 [R=301,L]

        Thanks for the replies... I am getting an error when using the code above : ERR_TOO_MANY_REDIRECTS
        Highly caffeinated
        http://www.coffeehouseexpress.com

        Comment


          #5
          Try this:

          RewriteCond %{http_host} ^coffeehouseexpress.com [NC]
          RewriteRule ^(.*)$ http://www.coffeehouseexpress.com/$1 [R=301,L]
          Andreas Toman
          PCINET, LLC

          Miva Merchant Design, Development, Integration & Support
          We built over 200 Miva Merchant stores!
          Miva shopping cart design & integration service and see our Portfolio!


          e-mail: [email protected]
          web: www.pcinet.com
          LinkedIn: Andreas Toman
          phone: (786) 250-2056 (Miami, FL)

          Comment


            #6
            Originally posted by PCINET - Andreas View Post
            Try this:

            RewriteCond %{http_host} ^coffeehouseexpress.com [NC]
            RewriteRule ^(.*)$ http://www.coffeehouseexpress.com/$1 [R=301,L]

            Thanks Andreas! That did it, seems to work fine!
            Highly caffeinated
            http://www.coffeehouseexpress.com

            Comment


              #7
              Originally posted by ILoveHostasaurus View Post
              That will still work and should be the first thing in the file so the subsequent request that is analyzed for short links, etc. is already using the hostname you want it to be on:

              Code:
              RewriteEngine On
              RewriteCond %{HTTP_HOST} !^www.coffeehouseexpress.com$ [NC]
              RewriteRule ^(.*)$ http://www.coffeehouseexpress.com/$1 [R=301,L]

              I'm sorry ILoveHostasaurus , your code does work too ! I did not have the "www" in the RewriteCond.
              Highly caffeinated
              http://www.coffeehouseexpress.com

              Comment

              Working...
              X