Get help. Give help. A Web Design and Development Community.

Need Help with .htaccess and PHP

  • # July 22, 2009 at 4:26 am


    Necessary Knowledge

    My .htaccess file redirects like this: to

    RewriteRule ^([^/.]+)/?$ index.php?page=$1 [L]

    The "page" variable is used in a php include:

    < ?php include_once($_SERVER['DOCUMENT_ROOT']."/contents/".$page.".html"); ?>

    The "contents" folder simply contains .html files that are included as the content

    Okay here’s the problem:

    I have a "subfolder" in the "contents" folder with additional .html files that I need to access
    Now I’m trying to redirect like this: to

    This works:

    RewriteRule ^([^/.]+/[^/.]+)/?$ index.php?page=$1

    But now I can’t access the subfolder from: because there is a ‘page’ variable

    < ?php $page = $_GET['page']; if(!$page) { $page = 'index'; } ?>

    Any thoughts, ideas, or help would be greatly appreciated.

    Thanks in advance

    # July 22, 2009 at 11:01 am

    This reply has been reported for inappropriate content.

    try this little gem

    # July 22, 2009 at 3:37 pm
    "ikthius" wrote:

    Great little resource, but it didn’t have RewriteRule’s. It only had Redirect and I’d like to not have to write a Redirect for each url.

    Thanks for the tip

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We have a pretty good* newsletter.