Jump to content

How to send differen pages from server


Cupidvogel

Recommended Posts

I have noticed that in Stackoverflow, there are basically 4-6 kinds of different URLs. One is for questions, like DOUBLE vs DECIMAL in MySQL. One is for user profile page, like http://stackoverflow.com/users/1469954/cupidvogel. One is for new question, like http://stackoverflow.com/questions/ask, etc.

 

With each page request, the server sends a page as required. Now how do I achieve this on the server side? Should there be one catchall PHP script, which will parse the URL to note what type of page is the client asking (for example, if it parses the URL and finds out that the client is asking for a topic page, it will perhaps extract the question id/text from the URL, query the DB to fetch relevant data, construct the HTTML and send it) and send it accordingly, or should there be separate scripts for each page type? And for either, how do I configure PHP/Apache for this?

 

If I have a page like foo.php, I can see it through http://localhost/foo.php. But if I want it to capture http://localhost/foo.php as well as http://localhost/foo.php/ask/questions, etc, what do I have to do?

 

Link to comment
Share on other sites

"Something 101" is a term derived from the US school system, where the first year class you have on any particular subject is called "Something 101". In other words, the question you're asking is as basic as you can get it. Which, in turn means you're basically asking us something that can be equated to "I want to do something I need to know physics for, how can I do physics?"

 

Now, since this is the "PHP coding help" section, you'll have to show us the code you've got so far, along with an explanation of why you've done it, what you expect to get out of it, and what you did get. Otherwise we're unable to help you, as anything we'd say would be pure guesswork on a very wide and general basis.

If you're looking for guides on how to create dynamic web pages, then a trip to the "Application Design" section, or (even better) do a search online for tutorials.

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.