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.