Urgent: Dynamic -> Static .htaccess Modrewrite

Discussion in 'Apache' started by MilesB, Jan 19, 2008.

  1. #1
    My site www.animeomnitude
    Uses the current structure of

    site.com/?page=page
    site.com/?page=folder/page
    site.com/?page=folder/folder/page

    using this include code
            <?php
    if(!isset($_GET['page'])) {
    include "news.php";  
    }elseif(!file_exists($_GET['page'].".php")) { // this also takes you to the home page if the page you're looking for using the ?page= dosn't exist
    include "news.php";  
    }else{ //if all goes well
    include $_GET['page'].".php"; // include the page e.g if it was ?page=tutorials include tutorials.php
    }  
    
    ?
    PHP:
    I tried using this .htaccess code
    RewriteEngine On
    RewriteRule ^/$ /?page=home [L]
    Code (markup):
    Some reason it doesn't work. It it because I have different paths for different links? e.g /page /folder/page etc?

    Can someone make me a modrewrite that will work on all of my urls and will I have to change all my hyperlinks or will I keep using
    < a href="?page=xxxxxx
    HTML:
    to do my links?

    Thanks
     
    MilesB, Jan 19, 2008 IP