Forum Moderators: coopster

Message Too Old, No Replies

Outputting data as default

         

m4tt

12:28 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



I have a slight problem that I can't come up with an answer for. I have set up a cms that works great however it works based on the following

www.yoursite.com/?p=home
www.yoursite.com/?p=services

So that the navigation calls up the relevant page. However when I type:

www.yoursite.com - It comes up with no data because none has been called...

Does anyone know how to set it up so if you go to

www.yoursite.com it goes to say the default home page?

Thanks in advance!

Also can anyone help with changing /?p=home ot a permalink:
/home/
/services/

etc?

Here is the code in the index.php:

<?
include("/includes/config.php");
include("/library/config.php");
include("/library/opendb.php");

$pagename=$_POST['p'];
$query=" SELECT * FROM pages WHERE pagename = '{$_GET['p']}'";
$result=mysql_query($query);
$num=mysql_num_rows($result);

$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$pagename=mysql_result($result,$i,"pagename");
$content=mysql_result($result,$i,"content");
?>

<?php

if (get_magic_quotes_gpc())
{
$content = stripslashes($content);
}
?>
<? echo "$content"?>

<?
++$i;
}
?>

nfs2

12:30 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



Hi, does your server run apache? If so, mod_rewrite can do all that for you.

m4tt

12:39 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



Yeah, it does but I am not sure how to use mod rewrite? Are you able to assist?

nfs2

12:51 pm on Apr 12, 2006 (gmt 0)

10+ Year Member



Unfortunatly im no expert in mod_rewrite, but there's a forum here thats been a great help to me, its just a few forums down

Good luck

jatar_k

5:11 pm on Apr 12, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



try this thread from the Apache Forum [webmasterworld.com] library [webmasterworld.com]
An Introduction to Redirecting URLs on an Apache Server [webmasterworld.com]