Jump to content

How do the URL's work, do they use PHP?


pappakaka

Recommended Posts

I'm sorry if this maybe is an obvious understanding for you, but i can't understand one thing with URL's.

 

If i create my page called "index.php" and put it in a folder called "folder" then the URL in the address bar would be: http://www.website.com/folder/index.php

 

But then i deside to add a few more pages with like next and previous links to scroll through them. I put those pages in a folder called "pages" within the folder "folder". Now the URL's would something look like this!

 

http://www.website.com/folder/pages/page1.php

http://www.website.com/folder/pages/page2.php

etc...

 

Thats the only way i know URL's are created and look like. But now too my question..

 

This is a few URL's i've seen on a site and every URL leeds to a new page but there is no slashes indicating new folders? How do you do that? Here is some examples of how the URL's could look like:

 

http://www.website.com/index.php

http://www.website.com/index.php?p=new

http://www.website.com/index.php?p=new&page=121

http://www.website.com/merge.php

http://www.website.com/merge.php?id=20381

 

And every URL was a comnpletly new page?  :shrug:

 

Link to comment
Share on other sites

It's

-http://www.website.com/folder/index.php <- your main page for the folder (if you have one)

-http://www.website.com/folder/page1.php

-http://www.website.com/folder/page2.php and so on

 

You (or at least I do) build these types with a get statement and guery

-http://www.website.com/index.php?p=1

-http://www.website.com/index.php?p=2

 

PS as cyberrobot said, pages like -http://www.website.com/index.php?p=1 pull info from the database

 

Link to comment
Share on other sites

This is the basics of dynamic content. Generally, you pass data through the url, this data is used within the page then to identify some content (generally stored in a database) and display it.

 

A simple example.

 

<?php

if (isset($_GET['id'])) {
  $id = $_GET['id'];
} else {
  $id = 1;
}

echo "This is page number $id<br />";
echo "Click <a href='?id=" . $id+1 . ">here</a> to see page number " . $id+1;

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.