1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

.htaccess not redirecting properly

Discussion in 'General Scripting Chat' started by DesignEx, Oct 26, 2011.

  1. DesignEx

    DesignEx Regular Member

    Joined:
    Mar 11, 2011
    Messages:
    256
    Likes Received:
    51
    Occupation:
    Own a web development company
    Location:
    Florida
    I have a database that I wanted to use to populate a bunch of different pages, but instead of showing url.com/phpscript.php?query=XXXXX, I wanted it to process url.com/category/XXXX.html

    I have it working, but my problem is that Google is still indexing the PHP script with the query (and it's appearing in the toolbar as well).

    My .htaccess looks like this:

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^category/(.*)\.html$ /category.php?string=$1 [NC,L]

    Any idea on how to make this look like 100% HTML from the outside?
     
  2. appman360

    appman360 Newbie

    Joined:
    Sep 21, 2011
    Messages:
    12
    Likes Received:
    5
    I think you'd have to change all the links on your site.

    If you've already done that, you probably just need to wait for google to replace the old links.

    The htaccess only rewrites the pages so that category/something.html can be used instead of category.php?string=something.
     
  3. theMHR

    theMHR Junior Member

    Joined:
    Apr 27, 2011
    Messages:
    124
    Likes Received:
    19
    He is right, you have to change the links on all pages. But I have get the same problem with one of my site, I change all the links as well as change the .htaccess script but Google is still indexing those dynamic URLs so then I contact an apache expert on some other forum, they tell me the arrangement of your .htaccess Rewrites or Recond are wrong, you have to correct them, then I send whole my .htaccess to him, so he sends me the correct arrangement.

    If you can send me then I will send you back in this forum in correct arrangement.