#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    29
    Rep Power
    0

    Redirect to different html type


    Hi everyone,

    I revamped my site and to avoid too many broken links, I added a .htaccess file. Most links redirect fine, but some don't, for example this:

    Redirect /product_a/download.htm /products/product_a/download.shtml

    I put all products into a folder and changed .htm files to .shtml files.

    The error I'm getting is a 300 Multiple Choices, so it looks to me as if the redirect is looking specifically for
    /products/product_a/download.htm

    Any idea how to fix that?

    Thanks much!
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,434
    Rep Power
    9645
    Does /products/product_a/download.shtml work if you go to it normally?

    You also need to use permanent redirects for this - Redirect does temporary redirects by default.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    29
    Rep Power
    0
    Originally Posted by requinix
    Does /products/product_a/download.shtml work if you go to it normally?

    You also need to use permanent redirects for this - Redirect does temporary redirects by default.
    Hi requinix, yes, the page works perfectly well with bookmark or typing the URL. I don't know the difference between a temporary and a permanent redirect.

    Thanks
  6. #4
  7. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,434
    Rep Power
    9645
    A temporary redirect indicates that the original URL should still be used in the future while a permanent redirect means it should not be. It's particularly important for search engines so they know that the old URLs should not be used anymore.

    Not sure why Redirect is being odd. Are you using MultiViews or mod_speling?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    29
    Rep Power
    0
    Originally Posted by requinix
    A temporary redirect indicates that the original URL should still be used in the future while a permanent redirect means it should not be. It's particularly important for search engines so they know that the old URLs should not be used anymore.

    Not sure why Redirect is being odd. Are you using MultiViews or mod_speling?
    Thanks again.. I don't know what either MultiViews or mod_speling is, so my guess is I don't use it ;-)
    How do I make the redirect permanent? Perhaps that will solve the problems. I don't need the old URLs again.
  10. #6
  11. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,434
    Rep Power
    9645
    Originally Posted by stefangs
    I don't know what either MultiViews or mod_speling is, so my guess is I don't use it ;-)
    Actually that 300 error suggests you do. It's quite possible it's there even if you don't know about it.

    Try adding
    Code:
    Options -MultiViews
    <IfModule mod_speling.c>
      CheckSpelling off
    </IfModule>
    Originally Posted by stefangs
    How do I make the redirect permanent? Perhaps that will solve the problems. I don't need the old URLs again.
    When in doubt, check the documentation.
    Last edited by requinix; February 6th, 2017 at 05:44 AM.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    29
    Rep Power
    0
    Originally Posted by requinix
    Actually that 300 error suggests you do. It's quite possible it's there even if you don't know about it.

    Try adding
    Code:
    Options -MultiViews
    <IfModule mod_speling.c>
      CheckSpelling off
    </IfModule>

    When in doubt, check the documentation.
    I added the bit of code (copy/paste), but it didn't make a difference.

    So the takeaway right now is this:

    1) all redirects that point from an old directory to a new directory work, e.g.
    Redirect /product_a/ /products/product_a/

    2) all redirects that point from an old page to a new page fail, e.g.
    Redirect /product_a/download.htm /products/product_a/download.shtml

    Thanks for the pointer to the documentation. I changed the redirects to permanent, but that also made no difference.

    Unfortunately, I can't even redirect from an old page to a new directory which would be an ok fallback, e.g.

    Redirect /product_a/download.htm /products/product_a/

    If I try that, I get a 404 error.

    Any more ideas?

    Thanks
  14. #8
  15. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,434
    Rep Power
    9645
    Huh...

    Does /product_a exist as an actual directory? If so, what files and directories are in it?
    Does /products/product_a exist as an actual directory? If so, what files and directories are in it?
    Specifically interested in knowing if there are any other download.* files.

    And what's in download.shtml? Are you using any SSI directives, and if so then what?
  16. #9
  17. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    29
    Rep Power
    0
    Yes, the directory exists. The site looks something like like this:

    index.shtml
    /products
    ---/product_a
    ------index.shtml
    ------download.shtml
    ------more.shtml
    ---/product_b
    ------index.shtml
    ------....


    All files are of type .shtml and contain two SSIs:
    <!--#include virtual="/resources/includes/head.incl" -->
    and
    <!--#include virtual="/resources/includes/footer.incl" -->

    This lets me focus on what's different among the pages and do away with the header/footer fluff. There are no other download. files. Every product directory has one.

    Hope this makes sense.
    Thanks for your patience!

IMN logo majestic logo threadwatch logo seochat tools logo