/    Sign up×
Community /Pin to ProfileBookmark

URL Navigation

Hi,
Is it possible, with PHP, to produce a URL system that works like that of Wikipedia? I just can’t figure it out.
All it needs is en.wikipedia.org/wiki/ and then you can put the title of what ever you want after that and it will find it. Such as, [url]http://en.wikipedia.org/wiki/Website[/url]. I highly doubt that they have a page for each article so how do you make it grab the bit off the end and search for it within a database. I can do the searching in a database if I know how to grab the string.

Basically, you go to something/an_article and it will then go to something/article.php?a=an_article but keep the original URL over the top to hide it.

Any clues?
Thanks.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@x_CharlieJul 29.2006 — Well heres a method I use. Place the following line of code into your .htaccess file:
<i>
</i>ErrorDocument 404 /index.php


Then here is the code to sort out the navigation

[code=php]
<?php
header("HTTP/1.1 200 OK");
$var_array = explode("/",$_SERVER['REQUEST_URI']);
$file = $var_array['1'];
if(!$file||$file=="index.php") {
include("home.php");
}
elseif(file_exists("$file.php")) {

include("$file.php");

}
else {
echo "<h2>404</h2>Page requested could not be found. This could be becuase:
<ul><li>The file/page does no exist</li>
<li>The file/page has been moved or deleted</li>
<li>The file name provided is misspelt or cont
</ul>";
}
?>
[/code]

that just grabs the /file/ extension and uses it just like a ?id=file etc.. and includes it..
×

Success!

Help @sftrprod spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...