SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2007
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP URL Rewriting. I deleted my page but it's still active on my website?

    Hi Everyone,

    I uploaded php code that changed my URLS (for smart URLS). I also had to configure my .htaccess. Here's my problem. I deleted the page that produces my URLS (that syntax is below) but the page is still active on my website. I know something is wrong but I'm not sure what it is.

    The below code I deleted from my website but the URLS are still working? I have no idea why ....

    http://whatsmyowncarworth.com/class-.../florida/miami
    http://whatsmyowncarworth.com/class-...orida/key-west

    PHP Code:
    <?php
    include 'header.php';

    if (isset(
    $_GET['u'])) {
           
    $city str_replace('-',' ',urldecode($_GET['u'])); 
           
    $state str_replace('-',' ',urldecode($_GET['s'])); 

        
    // if value contains only letters, numbers or spaces...
        
    if ( preg_match('~^[a-z0-9 ]+$~i',$city) ) {
            
    // select data from database...
            
    $data mysql_query("SELECT State, City FROM states WHERE City='$city'" );
            if (
    mysql_num_rows($data) > 0) {
                while (
    $row mysql_fetch_assoc($data)) {
                    echo 
    $row["City"].'<br>'
                    
    // echo $row["State"].'<br>';
                    
    echo 'This is what I get when I echo $_GET '.$_GET['u'].'<br>';
                    echo 
    var_dump($city)."<br>";
                }
            }
        }


    ?>
    I didn't delete the .htaccess rewrite code from my website.

    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)/(.*) /auto/cars.php?s=$1&u=$2 [L,NC]

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    8,900
    Mentioned
    138 Post(s)
    Tagged
    2 Thread(s)
    The RewriteRule rewrites your URLs to for example /auto/cars.php?s=class-work&u=sign3/florida/miami

    You can either prevent the showing of a website and send a 404 header and page from PHP, or exclude URLs that start with class-work in apache like so

    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/class-work/
    RewriteRule ^([^/]+)/(.*) /auto/cars.php?s=$1&u=$2 [L,NC]
    Rémon - Hosting Advisor

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy


Bookmarks

Posting Permissions

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