URL rewriting.. Need a small bit of help

Discussion in 'Programming' started by -bank-, Feb 13, 2008.

  1. #1
    Dear All,

    I'm trying to rewrite my dynamic php urls, to friendlier seo'ed ones, ie .html or directory style, although I've had little success in using this in my .htaccess file:
    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule file-docs-(.*)\.html$ file.php?docs=$1
    
    PHP:
    It doesn't seem to process the variable correctly, meaning the incorrect content is displayed, any ideas?

    Thanks
     
    -bank-, Feb 13, 2008 IP
  2. srobona

    srobona Active Member

    Messages:
    577
    Likes Received:
    57
    Best Answers:
    0
    Trophy Points:
    88
    #2
    What about these?

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteRule (.*)page-(\d+)\.htm[l]?(.*)$ $1/?p=$2 [PT,NC]

    Let me know if it works
     
    srobona, Feb 13, 2008 IP
  3. shanaka

    shanaka Active Member

    Messages:
    409
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    81
    #3
    -bank- is it working now ? let me know if you need any help. srobona's code should be work. if not send me PM.
     
    shanaka, Feb 15, 2008 IP