Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2009
    Posts
    63
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Question htaccess code needed- To try .php extension before 404

    Hi, I am looking for some htaccess lines, this is what I want to do:

    www.domain.com/page1.shtml it would usually 404 because I only have page1.php. The extensions don't match..

    The obvious answer is 301 redirect page1.shtml to page1.php But the problem is I have over 18,000 pages that need to be done..

    So I would like to add a line in htaccess that says: If no match, try replacing the extension with .php BEFORE 404-ing...

    I already have a 404 script that does this- it will forward people to the new php page- BUT it would be much better for search spiders if it redirected to a .PHP extension BEFORE it 404's/

    Any help?

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,826 Times in 1,810 Posts
    Hello shakemelikeapig,
    Does this do anything for you?
    http://kb.mediatemple.net/questions/...access+file%3F

    If not that, then https://www.google.com/search?q=.hta...=1331&bih=1047
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    New Coder
    Join Date
    Dec 2009
    Posts
    63
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Quote Originally Posted by Excavator View Post
    Hello shakemelikeapig,
    Does this do anything for you?
    http://kb.mediatemple.net/questions/...access+file%3F

    If not that, then https://www.google.com/search?q=.hta...=1331&bih=1047
    NO- No help there. And I know how to use google.

    If you want to give me a link to read- please verify the link addresses the issue I asked about.

    This is what I need:
    If file does not exist- change extension to .php and check for a match. If match=YES 301 to the .php page. If no php page exists either- only then 404

    thanks!

  • #4
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,332
    Thanks
    5
    Thanked 363 Times in 360 Posts
    NO- No help there. And I know how to use google.

    If you want to give me a link to read- please verify the link addresses the issue I asked about.
    Maybe you dont...lol so here I found the some articles you can read with a simple google search.

    http://forums.digitalpoint.com/showthread.php?t=5801

    http://css-tricks.com/how-to-redirec...l-to-indexphp/ Hope that helps.
    Teed


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •