rewriterule for two php files?

Discussion in 'Site & Server Administration' started by delphix, Jun 26, 2007.

  1. #1
    Hi,

    I have coded a script. Now I want to make html pages via rewriterule.

    I'm getting the pages via their id.

    www.sitename.com/article.php?id=1 id=2 etc.

    I wrote this to my htaccess and it actually works.

    RewriteRule ^(.*)-(.*).html$ article.php?id=$2 [L,NC] It becomes something like that.

    www.sitename.com/page-name-id.html

    But the problem begins here;

    I have another php page called read.php, which has the same system with article.php

    I wrote one more line to my htaccess such as,

    RewriteRule ^(.*)-(.*).html$ read.php?id=$2 [L,NC]

    Once I want to call a page from read.php, it does not work because of the first htaccess code and the same path of them.

    I wrote this to change the path so It wouldn't get confused because of the codes, but didn't work.

    RewriteRule read/^(.*)-(.*).html$ read.php?id=$2 [L,NC]

    and made www.sitename.com/read/page-name-id.html But it still gives me the page of article.php

    What should I do to make work both of them?

    Thanks.
     
    delphix, Jun 26, 2007 IP