1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php and .htaccess rewrite.

Discussion in 'PHP' started by killaklown, Dec 17, 2007.

  1. #1
    How can I do
    SEMrush
    
    if($_GET['category'] == $cat) {
    
    //stuff
    
    }
    
    with .htaccess rewrite on?

    The rewrite is:
    RewriteRule ^category/([^/]+)?$         index.php?category=$cat [QSA,L]
    
    Code (markup):

    I cant seem to get it to work. (never did rewrite before)
     
    killaklown, Dec 17, 2007 IP
    SEMrush
  2. hogan_h

    hogan_h Peon

    Messages:
    199
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Did you try this:
    
    RewriteEngine On
    RewriteRule ^category/([^/]+)?$         index.php?category=$1
    
    Code (markup):
    You can call url then with http://www.yourwebsite.com/category/5
    
    if(isset($_GET['category'])) {
    
    echo "Category is: ".$_GET['category'];
    
    }
     
    hogan_h, Dec 17, 2007 IP
    killaklown likes this.
  3. killaklown

    killaklown Well-Known Member

    Messages:
    2,666
    Likes Received:
    87
    Best Answers:
    0
    Trophy Points:
    165
    #3
    thanks. +rep!
     
    killaklown, Dec 18, 2007 IP
    hogan_h likes this.