1 Reply Latest reply on Nov 26, 2009 8:46 AM by Chrstnmgcn

    RewriteRule with SSI Include

    Chrstnmgcn

      I've been using ADDT for many years (when it was with Interakt) and this is the first issue I can't seem to get around.

       

      I am creating an SEO friendly page that works great as lon as the final URL is still in the root directory.

      http://www.domain.com/page.php?name=this-is-a-test -> http://www.domain.com/this-is-a-test

       

      However, what I want is:

      http://www.domain.com/page.php?name=this-is-a-test -> http://www.domain.com/page/this-is-a-test

       

      I have a <base> element in the page and that works for the main stylesheet, but the included files (there are several) are still referencing the virtual directory it's now in (i.e. "/page") and they don't have the correct paths.

       

      Here is the code for the page. Any ideas how to get around this? I'd like to have separate pages for page.php (/page/seo-name), headline.php (/headline/seo-name), giveaway (/giveaway/seo-name), etc.

       

      Thanks!

      Paul

       

      .htaccess

      Options +FollowSymLinks
      RewriteEngine on
      RewriteBase /
      
      # For Friendly URLs
      RewriteRule ^page/([^/\.]+)/?$ page.php?name=$1 
      

       

       

      page.php

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title><?php echo $site_title; ?></title>
      <meta name="Keywords" content="<?php echo $meta_keywords; ?>" />
      <meta name="Description" content="<?php echo $meta_description; ?>" />
      <base href="<?php echo $base; ?>" />
      <link href="styles.css" rel="stylesheet" type="text/css"/>
      </head>
      <body>
      <div id="wrapper-florets">
          <div id="wrapper-main">
              <?php
                mxi_includes_start("inc_headernav.php");
                require(basename("inc_headernav.php"));
                mxi_includes_end();
              ?>
          <div id="content">
              <div id="home-main">
                  <div id="flash"></div>
                  <div id="general">
                      <div class="general-top">
                          <h1><?php echo $row_rsPage['title_page']; ?></h1>
                      </div>
                      <div class="general-bg"> <?php echo $row_rsPage['content_page']; ?> </div>
                      <div class="general-bottom"></div>
                  </div>
              </div>
              <div id="right">
                  <?php
                    mxi_includes_start("inc_rightall.php");
                    require(basename("inc_rightall.php"));
                    mxi_includes_end();
                  ?>
              </div>
          </div>
          <?php
                mxi_includes_start("inc_footerads.php");
                require(basename("inc_footerads.php"));
                mxi_includes_end();
              ?>
      </div>
      <?php
                mxi_includes_start("inc_footer.php");
                require(basename("inc_footer.php"));
                mxi_includes_end();
              ?>
      </div>
      </body>
      </html>
      
      
      
        • 1. Re: RewriteRule with SSI Include
          Chrstnmgcn Level 1

          I should also add that I know it's an issue with MX Includes and not wih the page coding itself.

           

          I say this because everything works fine if I use a standard include and not the MX Include.

           

          This works

          <?php
                    include("inc_headernav.php");
          ?>

           

          This doesn't

          <?php
                    mxi_includes_start("inc_headernav.php");
                    require(basename("inc_headernav.php"));
                    mxi_includes_end();
          ?>

          I hope that helps. I did create a workaround, but I'd really like to get this to work.

           

          This is the workaround.

           

          I simply placed page.php and headline.php in a real folder called /seo. So the revised .htaccess file looks like this.

          RewriteRule ^page/([^/\.]+)/?$ seo/page.php?name=$1 
          RewriteRule ^headline/([^/\.]+)/?$ seo/headline.php?name=$1