Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    62
    Member #
    4758
    On my website (using Zen Cart) I am having problems with the 404 forwarding. It works as long as the wrong address is like this:

    http://webSite.com/index.php?main_page=wrongPage

    Is there a way I can make this work so that if a user types in:

    http://webSite.com/wrongPage

    they are brought to:

    http://webSite.com/index.php?main_page=page_not_found


    Thanks.
    - flipjargendy

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    I think you could probably set up an ErrorPage directive that points it to the appropriate page.

  4. #3
    ljm
    ljm is offline
    Senior Member ljm's Avatar
    Join Date
    Aug 2006
    Location
    Manchester, England
    Posts
    284
    Member #
    13684
    Liked
    1 times
    Correct me if I'm wrong, but I'm not sure you could use .htaccess to validate the existence of a URL in a query string. I'm thinking you would have to use PHP to do that, and to show an error page if the requested one doesn't exist. You could then use .htaccess to turn that specific page into a proper 404 error page.

  5. #4
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Well, I believe what he was saying was that the software he's using already handles the wrong-querystring situation, but he also wants to handle the actual 404 situation. The ErrorPage directive allows you to specify an alternate URI for when 404s occur, so it should do the trick just fine.

  6. #5
    ljm
    ljm is offline
    Senior Member ljm's Avatar
    Join Date
    Aug 2006
    Location
    Manchester, England
    Posts
    284
    Member #
    13684
    Liked
    1 times
    Oh yeah, I misread the post, thinking that he wanted to rewrite the URL to something friendlier, THEN validate it.

    Yeah, I agree with what you say, in that case.

  7. #6
    Member
    Join Date
    Jan 2004
    Posts
    62
    Member #
    4758
    I believe what he was saying was that the software he's using already handles the wrong-querystring situation, but he also wants to handle the actual 404 situation.
    Yes, my current software is directing properly. I have .htaccess setup for the error page. But it only works if the URL is typed with the index.php?main_page=blah.

    I think you could probably set up an ErrorPage directive that points it to the appropriate page.
    How would I go about that? Is there usually a file that handles this in PHP content management systems? I'm not quite sure what I'd do a search on so any input how to fix this and/or a suggestion for what I could do a search on would be great!

    Thanks :-)
    - flipjargendy

  8. #7
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    I believe in .htaccess, you just write:

    Code:
    ErrorPage 404 index.php?main_page=page_not_found
    Someone will correct me if my syntax is off... It may not work with GET parameters, I'm not sure. If it doesn't, you can probably use mod_rewrite to take care of that issue.

  9. #8
    Member
    Join Date
    Jan 2004
    Posts
    62
    Member #
    4758
    The syntax is correct. It's working correctly with that in the .htaccess file... except when someone fails to type in: index.php?main_page=

    If they only type in host.com/wrongPage it brings them to a page the server has. It just says "Not Found".
    - flipjargendy


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:46 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com