Announcement

Collapse
No announcement yet.

Redirecting urls /p/product-code/ to /p/product-code.html in bulk

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

    Redirecting urls /p/product-code/ to /p/product-code.html in bulk

    SEO company has found, and wants redirected, 665 product urls with 301 redirects.

    URLs are in the form of:

    /p/product-code/

    But, they want them to be:

    /p/product-code.html

    I came late to the party, and have no idea why those were formed as /p/product-code/ in the first place and since been indexed as so.

    Is there some rule for htaccess that would cover all of them. Like a bulk rewrite? I know I can do canonical, but they want redirects on them all. I am really hesitant to add 665 redirects to an htaccess file that is already way too large for my comfort.

    I hope someone can help. Thanks in advance.

    Jamie
    Jamie Donaldson
    JSDVS Web Design / Development
    Web Design | Web Development | E-commerce Design & Integration

    #2
    ok, not an htaccess wizard, but this might work (and MAKE A BACKUP :) )

    RewriteRule ^/p/([^/.]+)/$ /p/$1.html [R=301,L]

    this says: If the url begins with /p/ (after the domain) than take what's between / and / and then stuff it in where $1 is.

    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      Are you using URI management? The relevant desirable URI's could be imported, set as the canonical, etc. It is really not desirable, both for performance and Apache-dependency reasons, to handle these kinds of things via ever-growing htaccess files.
      David Hubbard
      CIO
      Miva
      [email protected]
      http://www.miva.com

      Comment


        #4
        David, which URIs could be imported? Example?

        Scott
        Need to offer Shipping Insurance?
        Interactive Design Solutions https://www.myids.net
        MivaMerchant Business Partner | Certified MivaMerchant Web Developer
        Competitive Rates, Custom Modules and Integrations, Store Integration
        AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
        My T-shirt Collection is mostly MivaCon T-shirts!!

        Comment


          #5
          Originally posted by ILoveHostasaurus View Post
          Are you using URI management? The relevant desirable URI's could be imported, set as the canonical, etc. It is really not desirable, both for performance and Apache-dependency reasons, to handle these kinds of things via ever-growing htaccess files.
          Oh, yea, those could be handled by URI by chaging the 'slugify' code. I don't even thing you'd need to import. Couldn't you just change the pattern and generate the URI/s
          Bruce Golub
          Phosphor Media - "Your Success is our Business"

          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
          phosphormedia.com

          Comment


            #6
            Originally posted by ids View Post
            David, which URIs could be imported? Example?

            Scott
            I believe you can import additional URI's per product, and then set the canonical URI + redirect.
            David Hubbard
            CIO
            Miva
            [email protected]
            http://www.miva.com

            Comment


              #7
              So, make this the canonical?

              /p/product-code.html

              Anything else that needs to be done?

              Scott
              Need to offer Shipping Insurance?
              Interactive Design Solutions https://www.myids.net
              MivaMerchant Business Partner | Certified MivaMerchant Web Developer
              Competitive Rates, Custom Modules and Integrations, Store Integration
              AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
              My T-shirt Collection is mostly MivaCon T-shirts!!

              Comment


                #8
                Originally posted by ILoveHostasaurus View Post
                Are you using URI management? The relevant desirable URI's could be imported, set as the canonical, etc. It is really not desirable, both for performance and Apache-dependency reasons, to handle these kinds of things via ever-growing htaccess files.
                Never got a notice that anyone replied, David. Thank you for asking. No, it is currently not using URI Management. What is the alternative in that case?
                Jamie Donaldson
                JSDVS Web Design / Development
                Web Design | Web Development | E-commerce Design & Integration

                Comment


                  #9
                  Originally posted by Bruce - PhosphorMedia View Post

                  Oh, yea, those could be handled by URI by chaging the 'slugify' code. I don't even thing you'd need to import. Couldn't you just change the pattern and generate the URI/s
                  Not using URI Management, Bruce. Stick with your example?
                  Jamie Donaldson
                  JSDVS Web Design / Development
                  Web Design | Web Development | E-commerce Design & Integration

                  Comment


                    #10
                    If you can't switch to URI management, I don't know of a better solution...but URI management, long term, is a better solution....now if only URI management could be used for non-miva URLs,
                    Bruce Golub
                    Phosphor Media - "Your Success is our Business"

                    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                    phosphormedia.com

                    Comment


                      #11
                      Originally posted by Bruce - PhosphorMedia View Post
                      If you can't switch to URI management, I don't know of a better solution...but URI management, long term, is a better solution....now if only URI management could be used for non-miva URLs,
                      Yep, the new site was designed (not by me), and launched in December. For the life of me, I have no idea why they didn't go ahead with uri management while in development. Some things are just a head scratcher.

                      I always appreciate your help and advice Bruce! Thanks. I will go with it.
                      Jamie Donaldson
                      JSDVS Web Design / Development
                      Web Design | Web Development | E-commerce Design & Integration

                      Comment


                        #12
                        Originally posted by Bruce - PhosphorMedia View Post
                        RewriteRule ^/p/([^/.]+)/$ /p/$1.html [R=301,L]
                        Just an update. The rewriterule didn't work. This is one of those weird-case scenarios. There are all kinds of things going on in this htaccess file. For example, I found the following near the bottom of the file, which may be an issue:

                        Code:
                            Remove .html and .htm:
                                ### Single line below is used to remove the .html not needed in URL
                                ### Except when inside documentation
                                RewriteCond %{REQUEST_URI} !^/documentation/site/
                                RewriteRule ^([^\.]+)$ $1.html [NC,L]
                        
                                ### Single line below is used to remove the .htm not needed in URL
                                ### Except when inside documentation
                                RewriteCond %{REQUEST_URI} !^/documentation/site/
                                RewriteRule ^(.*)\.htm /$1.html [NC,L]
                        But, I took that out and the problem links (/p/product-code/) went to Not Found pages. Not optimum, nor what the SEO company wants them to do (redirect to: /p/product-code.html).

                        Then, we have this, which looks like the directory of /p/

                        Code:
                        RewriteCond %{REQUEST_FILENAME} !-s
                        RewriteRule ^p/([^/]+)/([^/]+)$ /mm5/merchant.mvc?Screen=PROD&Product_code=$1&keylinkp=$2 [QSA,L]
                        Kind of thinking out loud here, but input is appreciated.
                        Jamie Donaldson
                        JSDVS Web Design / Development
                        Web Design | Web Development | E-commerce Design & Integration

                        Comment


                          #13
                          Rewrite conditions and rules are analyzed in order until a L directive is encountered, at which point no further parsing of the htaccess is performed. You'll have to organize the rules in the order they should be processed. Or move it all into uri management, preferably.
                          David Hubbard
                          CIO
                          Miva
                          [email protected]
                          http://www.miva.com

                          Comment


                            #14
                            Originally posted by ILoveHostasaurus View Post
                            Rewrite conditions and rules are analyzed in order until a L directive is encountered, at which point no further parsing of the htaccess is performed. You'll have to organize the rules in the order they should be processed. Or move it all into uri management, preferably.
                            That made sense David! You and Bruce are geniuses! Thank you both! I got it!

                            For posterity:

                            Proper positioning of:

                            Code:
                            RewriteCond %{REQUEST_FILENAME} !-s
                            RewriteRule ^p/([^/]+)/([^/]+)$ /p/$1.html [R=301,L]
                            Did the trick!
                            Jamie Donaldson
                            JSDVS Web Design / Development
                            Web Design | Web Development | E-commerce Design & Integration

                            Comment


                              #15
                              Hopefully going to URI Management soon!
                              Jamie Donaldson
                              JSDVS Web Design / Development
                              Web Design | Web Development | E-commerce Design & Integration

                              Comment

                              Working...
                              X