Jump to content

Directories (pretty urls)


eleven0

Recommended Posts

So lets say i got a web page called "nice.php", which looks like this in browser "mysite.com/nice.php",

 

What do i need to do have it like this "mysite.com/nice" besides going to FTP and creating  a directory called "nice" and renaming that php file to "index.php"?

 

Is there another way of doing? Not sure how much this is related to php.

Link to comment
https://forums.phpfreaks.com/topic/98058-directories-pretty-urls/
Share on other sites

i dont know what your asking but here is a code im using, it doesnt need htacess


<?php $page = $_GET["page"];
if (!$page) {
include "/home.php";
}

else if($page=="home")       { include "/home.php"; }

else if($page=="contact")     { include "/contact.php"; }

else { echo "<b><h1>404 Error</h1></b>"; } 
?>

 

then

<a href="/index.php?page=home">

<a href="/index?page=home">

<a href="/?page=home">

 

will be the same

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.