eleven0 Posted March 26, 2008 Share Posted March 26, 2008 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 More sharing options...
p2grace Posted March 26, 2008 Share Posted March 26, 2008 You'd use htaccess for this. http://eisabainyo.net/weblog/2007/08/19/removing-file-extension-via-htaccess/ Link to comment https://forums.phpfreaks.com/topic/98058-directories-pretty-urls/#findComment-501717 Share on other sites More sharing options...
eleven0 Posted March 26, 2008 Author Share Posted March 26, 2008 That didn't work, but someone replied with correct code on that site. I got it working thanx. Would this be possible? from view.php?id=4 to view?id=4 Link to comment https://forums.phpfreaks.com/topic/98058-directories-pretty-urls/#findComment-501731 Share on other sites More sharing options...
dezkit Posted March 26, 2008 Share Posted March 26, 2008 yeh you can even make ?id=4 Link to comment https://forums.phpfreaks.com/topic/98058-directories-pretty-urls/#findComment-501733 Share on other sites More sharing options...
eleven0 Posted March 26, 2008 Author Share Posted March 26, 2008 how? Link to comment https://forums.phpfreaks.com/topic/98058-directories-pretty-urls/#findComment-501737 Share on other sites More sharing options...
dezkit Posted March 26, 2008 Share Posted March 26, 2008 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 Link to comment https://forums.phpfreaks.com/topic/98058-directories-pretty-urls/#findComment-501741 Share on other sites More sharing options...
eleven0 Posted March 27, 2008 Author Share Posted March 27, 2008 yea i know, i pretty much the have the same thing, when i use <a href="/?page=home"> I still see "index.php" just right before it. It somehow puts it there. Link to comment https://forums.phpfreaks.com/topic/98058-directories-pretty-urls/#findComment-502207 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.