Mod Rewrite help :: urls changing help me please

Discussion in 'PHP' started by cornetofreak, May 10, 2008.

  1. #1
    hey i am trying to use htaccess to rename my urls for seo but the one i have done does not work can someone tell where im goin wrong heres my codes

    My Url for search
    http://litewarez.com/index.php?stype=all&q=rapidshare&type=all&search2=Search
    Code (markup):
    My htaccess codes
    RewriteEngine On
    RewriteRule ^([^-]*)-q-([^-]*)-([^-]*)-([^-]*)\.html$ /index.php?stype=$1&q=$2&type=$3&search2=$4 [L]
    Code (markup):
    the output i want
    http://litewarez.com/all-q-rapidshare-all-Search.html
    Code (markup):
    if i copy and past the link it works but will google index them as the rewritten url ur the normal one!

    any new to mod-rewrite
     
    cornetofreak, May 10, 2008 IP
  2. xd2

    xd2 Peon

    Messages:
    694
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try
    RewriteEngine on
    RewriteBase /
    
    RewriteRule ^(*)-q-(*)-(*)-(*)\.html$ /index.php?stype=$1&q=$2&type=$3&search2=$4 [L]
    Code (markup):
     
    xd2, May 10, 2008 IP
  3. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thats bringing up an error 500 :(
     
    cornetofreak, May 10, 2008 IP
  4. xd2

    xd2 Peon

    Messages:
    694
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Dunno then, what I posted is exactly what i use and it works fine for me on all my websites.
     
    xd2, May 10, 2008 IP
  5. allaboutgeo

    allaboutgeo Peon

    Messages:
    85
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Try without "RewriteBase /".
     
    allaboutgeo, May 10, 2008 IP
  6. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #6
    my site runs on search do i need to mod the values of the script to mach the mod rewrite *im new to mod rewrite
     
    cornetofreak, May 11, 2008 IP
  7. cornetofreak

    cornetofreak Peon

    Messages:
    170
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #7
    heres my search code
    
        <p><br />
          Choose your search-datapath ::   
            <input type="radio" name="stype" value="all" checked="checked" />
          all files
      <input type="radio" name="stype" value="checked" />
          checked files </p>
        <p>     
          <input name="q" type="text" class="searchbox" size="60" />
          <select name="type">
            <option value="all" <? if($_GET['type']=='all') echo 'selected';?>>All</option>
            <option value="1" <? if($_GET['type']==1) echo 'selected';?>>Rapidshare</option>
            <option value="2" <? if($_GET['type']==2) echo 'selected';?>>Badongo</option>
            <option value="3" <? if($_GET['type']==3) echo 'selected';?>>Mediafire</option>
            <option value="4" <? if($_GET['type']==4) echo 'selected';?>>Sendspace</option>
            <option value="5" <? if($_GET['type']==5) echo 'selected';?>>4shared</option>
          </select>
          <input type="submit" name="search2" value="Search" />
          <br />
          </p>
      </form>
    PHP:
    if i search for e.g "MY SEARCH" th link will come threw as
    http://localhost/rapid/index.php?stype=all&q=MY+SEARCH&type=all&search2=Search
    Code (markup):
    can that be automaticall changed to the rewritten
     
    cornetofreak, May 11, 2008 IP