Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8563461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:57:55+00:00 2026-06-11T16:57:55+00:00

I am trying to figure out how to design an application which has documents(in

  • 0

I am trying to figure out how to design an application which has documents(in html-format)/content in a directory structure. What I want is that the URL should decide which document that should be presented. E.g. http://www.mydomain.com/docs/read_this should in some way help me present content named “read_this”.

I also want the possibility for the users to make a full search of the docs. First, I had the intent of storing all docs in MySQL and user the built in support for full search. But I got stuck in how to solve the URI vs. content problem. Since it should be possible to create or edit content I though that storing it in the database would make it easier than putting it in files as well.

This is the normal way of doing it, many sites implement it like this. Still, I cannot find anything about how to solve it. Perhaps the words used for googling is to similar to other info; document, directory, structure, content, URI, etc…

I am using Apache/httpd and PHP on CentOS 6.2.

What is the approach for solving above mentioned problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:57:56+00:00Added an answer on June 11, 2026 at 4:57 pm

    You’re almost creating a REST interface, but since you’re wanting to serve the documents directly, it’s not quite.

    I’d suggest a structure like:

    • http://example.com/docs/: Root level of your application (shows some info about the app
    • http://example.com/docs/view/read_this: Show the document named “read_this”
    • http://example.com/docs/search/keyword: Show a list of documents that contain the keyword “keyword”

    Adding the “view” and “search” parent “folders” prevents collision; if you just had http://example.com/docs/read_this as the document view schema (and left the search schema as-is), you could never have a document named search since that would collide with the special search term. You also mentioned editing, which could be done with a http://example.com/edit/read_this schema.

    In order to make all these URIs resolve, you’d need to use Mod_Rewrite in your Apache config to point them at your PHP script.

    EDIT: Here’s the .htaccess and PHP link needed

    .htaccess:

    This goes in the root of your docs folder, alongside index.php:

    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteRule ^([a-z]+)/([A-Za-z0-9_-]+)/?$ index.php?action=$1&target=$2 [QSA,L]
    </IfModule>
    

    This technically means that people could enter the URL http://example.com/docs/view/read_this or http://example.com/docs/index.php?action=view&target=read_this and get the same result

    index.php:

    <?php
    $action = (isset($_GET['action']) && $_GET['action'] != '')? $_GET['action'] : false;
    $target = (isset($_GET['target']) && $_GET['target'] != '')? $_GET['target'] : false;
    switch($action) {
      case 'view':
        viewDoc($target); // Do your view logic here
        break;
      case 'search':
        doSearch($target); // Do your search logic here
        break;
      case 'foobar':
        // Add new functionality here
        break;
      default:
        errorOut('No such action as '.$action);
        break;
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out how to design an iOS app that would connect
I'm trying to figure out how to design a small application more elegantly, and
This is a design problem that I am trying to figure out. I will
I'm trying to figure out what is the best general design for applications that
I am trying to figure out a design pattern that would allow hooking into
I'm trying to figure out what's the best design I can go with for
I'm trying to figure out the best way to design Car and Road objects
I'm trying to figure out the origin of the view handler design pattern in
An odd case I'm trying to figure out here. I'm trying to design a
I'm a novice to SQL scripting. I am trying to figure out a design

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.