Jump to content

Tidy and Modern Web Address question


gorgo666

Recommended Posts

Hello everyone.  I've beenputting off joining phpfreaks for a lonnggg time but here I am, finally!  ::)

 

But anyway.  I have a question that I've been pondering for ages, and it may be a little obvious so please don't ridicule me.

 

Most websites now-a-days seem to have completely removed file names from their addresses and navigation.  To give you an example, a lot of people may have used http://www.acme.com/about.php but now instead you only see http://www.acme.com/about/ which obviously refers to a directory.  It looks much tidier and is really Web 2.0...

 

Can someone elaborate on this?  Is it a behind the scenes CMS doing this, like Drupal or Wordpress?  Or is it simply people storing an index.php file inside that directory?

 

I look forward to any reply!  Cheers guys.

Link to comment
https://forums.phpfreaks.com/topic/116194-tidy-and-modern-web-address-question/
Share on other sites

It can also be a script which seperates the url into parts then includes a certain part of the url as a page.

 

example

You start of in www.acme.com/index.php. on that page you have a link which goes to www.acme.com/about. At the top of index.php you have something like this

<?php
$uri_split = explode("/", $_SERVER['REQUEST_URI']);
$tmp = array();
foreach($uri_split as $key => $val)
{
	if(!empty($val) || $val != "")
	{
		$tmp[count($tmp)] = $val;
	}
}
$uri_split = $tmp;
if(!isset($uri_split[0]))
{
	$uri_split[0] = "about_us";
}?>

 

Now you just include the page in index.php

include($uri_split[0]);

 

hope I got that right. Just grabs bits from one of my scirpt. :)

 

Ray

 

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.