views:

115

answers:

0

I have a WordPress-Installation with the permalink strukture /%postname%/

Now I'm working on a solution to include static html-pages into the WP-Framework. I am using a WordPress-page with the name "html" (page-html.php) to manage the include.

I would hand over the the old html-filename and path as a parameter to the page.

With the help of this geat article I managed to handle the old-url over to my page which nearly works. There are two problems, because my paramter not only is a normal string, it is a path and filename and a optional parameter:

  • WordPress adds a trailing / at the end of the url
  • If the old-url has a paramter itself, WordPress seperates it and I can't use it.

So here a some examples what I want after entering the url in my browser:

  1. www.domain.com/just-a-normal-post-or-page/

  2. www.mydomain.com/html/path/old.htm <- (Which hands path/old.htm to my page-html.php as a parameter/value)

  3. www.mydomain.com/html/path/another.php <- (Which hands path/another.php to my page-html.php as a parameter/value)

  4. www.mydomain.com/html/path/another.php?with=parameter <- (Which hands path/another.php?with=parameter to my page-html.php as a parameter)

Right now, this is what I get after entering the url:

  1. www.mydomain.com/just-a-normal-post-or-page/ <- OK, no change here

  2. www.mydomain.com/html/path/old.htm/ <- (Which in fact hands path/old.htm to my page-html.php, but I don't want the / at the end)

  3. www.mydomain.com/html/path/another.php/ <- (same as above)

  4. www.mydomain.com/html/path/another.php/?with=parameter <- (Which hands only path/another.php to my page-html.php and not the with=parameter. And it adds a unwanted / before the ?.)

I added the following rewrite rule, which does not work as I want:

$aNewRules = array('html(/[^\.]+[\.htm|\.php|\.php4|\.php5|\.html|\.shtml]?.*)$' => 'index.php?pagename=html&old_content=$matches[1]');