Jump to content

URL from /index.php?node=home To>>> /index?node=home using php?


shortysbest

Recommended Posts

would there be a way for me to change the url from

/index.php?node=home

to

/index?node=home

by using php? like similar to how i change node=home.php to node=home directly in php. I haven't been able to get it to work though.

 

my code for this page handling is:

 

<?php
$page = $_GET['node'];
if ($page)
{
//check for section
$path = "inc/".$page.".php"; 
if(file_exists($path))
{include($path);}
else
{$error = "inc/error.php"; include($error);}
}		
else
{$error = "inc/error.php"; include($error);}
?>

Open your .htaccess file and add following lines of code

 

RewriteEngine on
RewriteRule ^index?node=$1$ /index.php?node=$1/ [L]

 

I have explained this in thread

http://www.phpfreaks.com/forums/index.php/topic,292197.html

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.