Implementation problem. Htaccess in php

Posted by Irwan on Stack Overflow See other posts from Stack Overflow or by Irwan
Published on 2010-04-18T06:35:44Z Indexed on 2010/04/18 6:43 UTC
Read the original article Hit count: 239

Filed under:
|

I have a problem to fix the URL on my website at http://www.abelputra.com I need a solution:

I want to change www.abelputra.com/software.php into www.abelputra.com/software

I have read a tutorial like this: For .htaccess:

RewriteEngine On
RewriteRule ^ ([a-zA-Z0-9_-] +) $ index.php? Key = $ 1
RewriteRule ^ ([a-zA-Z0-9_-]+)/$ index.php? Key = $ 1

Then in php:

index.php --->

$Key=$ _GET ['key'];

if ($key == 'home')
{
    include ('index.php'); // Home page
}
else if ($ key == 'software')
{
    include ('software.php'); //
}
else if ($ key == 'webdesign')
{
    include ('webdesign.php'); //
}

The problem is:

When I implemented the menu software.php index.php to call the page:

www.abelputra.com/index.php?key=software

what happens is the page that is shown is two pages later software.php index.php page underneath.

Is it because calling functions "include ()"?

index.php structures:

  1. Header

  2. Content -> contains the opening words

  3. Footer

software.php structure:

  1. Header

  2. Content -> contains an explanation of my software

  3. Footer

Sorry my english bad. im from Indonesia.

Please solution .. thanks

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about php