Results 1 to 7 of 7
  1. #1
    pph Expert! Gordon's Avatar
    Join Date
    January 18th, 2005
    Location
    Edmonton Canada
    Posts
    5,781
    Due to merchants changing the categories I must be losing quite a lot of visitors and sales. My site is in php and I happened to notice no matter what I typed in the address bar it would come up (obviously empty) What I would like to know is, is there something I can put in my htaccess file so that unless a real url (with products) is entered they would go to my index page.

    Thanks in advance

    Gordon YouTrek.com
    <font color=red size="1">All parasites are scumbags and should be treated as such....</font><font color=blue size="1">STAMP EM OUT!!!</font>

  2. #2
    ABW Veteran Student Heyder's Avatar
    Join Date
    January 18th, 2005
    Posts
    5,482
    Gordon if you can use this it would probably be even better. It counts the number of results and if they are less than one you can do a redirect.

    $sql_num = mysql_query("SELECT * FROM table WHERE where");
    $num = (mysql_num_rows($sql_num) );

    if ($num < 1){

    //redirect to homepage

    //Redirect to Gordon's website.com homepage

    }
    else {

    //your current page body

    }
    // bottom of page

  3. #3
    pph Expert! Gordon's Avatar
    Join Date
    January 18th, 2005
    Location
    Edmonton Canada
    Posts
    5,781
    Thank you M.McNabb I will play with it and try to get it going

    Gordon YouTrek.com
    <font color=red size="1">All parasites are scumbags and should be treated as such....</font><font color=blue size="1">STAMP EM OUT!!!</font>

  4. #4
    pph Expert! Gordon's Avatar
    Join Date
    January 18th, 2005
    Location
    Edmonton Canada
    Posts
    5,781
    Thank you very much M.McNabb I just had to do a little playing with it and I added a bit so I finaly finished up with this and it works great. Thank you again


    $sql_num = mysql_query("SELECT * FROM table WHERE where") or die('<br>sql error because: ' . mysql_error());
    $num = (mysql_num_rows($sql_num) );

    if ($num < 1){

    require_once("page redirected to");



    }
    else {



    }

    Gordon YouTrek.com
    <font color=red size="1">All parasites are scumbags and should be treated as such....</font><font color=blue size="1">STAMP EM OUT!!!</font>

  5. #5
    ABW Veteran Student Heyder's Avatar
    Join Date
    January 18th, 2005
    Posts
    5,482
    I found the code online about a year ago it's part of a page results thing.
    ie (prev 123456 next)

  6. #6
    ABW Ambassador sjangro's Avatar
    Join Date
    January 18th, 2005
    Location
    Boston
    Posts
    1,529
    Gordon,

    You might consider redirecting instead of serving the content of a new page in the url or the old page.

    With your method, from what I can tell, you may be ending up with a bunch of duplicate pages as far as the search engines are concerned. Who knows what might happen, at the very least the wrong page might get dropped.

    So in the case where categories are gone, instead of filling up search engines with the same duplicate content, and leaving things to chance, do a permanent redirect to a new page. That tells the engine that the old page is no more and they should adjust.

    In PHP it looks like this:

    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.yoursite.com/newlocation.html");
    exit();

    If you leave out the first line, you get a 302 Moved Temporarily redirect which will be handled a little differently by spiders.

    Use the same logic that you already have in your script looking for zero products.

    Since you're outputting http headers, be sure not to print anything before those lines or you'll get an error. Printing stuff after those lines is fine.

    Or better yet, find something unique to put in those pages that already have search engine placement.

  7. #7
    Full Member
    Join Date
    January 18th, 2005
    Posts
    379
    What Scott said.

    If you have a reasons for doing it your way Gordon I'd like to hear it.

    I should implement a similar thing on my site.

    <hr>
    Leave the gun, take the cannolis.

  8. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. I am Stumped with a PHP/MYSQL problem
    By Uncle Rico in forum Programming / Datafeeds / Tools
    Replies: 3
    Last Post: August 13th, 2010, 06:19 PM
  2. Php code problem
    By cdunde1 in forum GoldenCAN
    Replies: 9
    Last Post: August 30th, 2008, 04:55 AM
  3. PHP fetch problem! Please help!
    By Affiliate Ian in forum Programming / Datafeeds / Tools
    Replies: 6
    Last Post: February 17th, 2005, 03:27 PM
  4. Problem running PHP
    By frank3iii in forum Programming / Datafeeds / Tools
    Replies: 2
    Last Post: July 7th, 2003, 11:11 PM
  5. ae.pl -- PHP Virtual problem
    By rardentech in forum Cusimano.com Scripts
    Replies: 5
    Last Post: June 28th, 2003, 05:55 PM

Posting Permissions

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