tags:

views:

32

answers:

1

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

A: 

I don't know if I understand correctly, but if you just want to rewrite the URLs (like removing the .php extension), you don't need to implement a gateway script or to change the logic code of your homepage (except modifying the URLs).

As an example, the following will allow to access your free tips with abelputra.com/freetips/185

RewriteRule ^freetips/(\d+)$ freetips_det.php?tip=$1 [L]

General extension removing is a well known topic, discussed here for example:

http://stackoverflow.com/questions/1068595

Wikser
my problem is how to implement it in php
Taruhku
my solution is how you don't need to, as your homepage is already working and you just want to change some URLs
Wikser
Yes, my web is working. but I see them eliminate most other websites .php and turn it into a folder. and according to me not omit the php extensions.I just do not know how to implement it in my php scripts.
Taruhku