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.

Mod Rewrite

Discussion in 'HTML & Website Design' started by Pudge1, Dec 27, 2013.

  1. #1
    Pudge1, Dec 27, 2013 IP
  2. jk.deff

    jk.deff Active Member

    Messages:
    59
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    55
    #2
    Try this code for .htaccess
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)-(\d+)$ /page.php?title=$1&id=$2 [L]
    Code (markup):
    Here I thought that You meant
    http://www.site.com/page.php?title=title-of-page&id=123456

    If the version
    http://www.site.com/page.php?title=title_of_page&id=123456
    is correct, then on page.php will need to make a replace
    if(isset($_GET['title']))
        $_GET['title'] = str_replace('-', '_', $_GET['title'] );
    Code (markup):
     
    Last edited: Dec 27, 2013
    jk.deff, Dec 27, 2013 IP
    Arick unirow likes this.