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

  • SEARCH
  • Home
  • 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 7528029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:15:51+00:00 2026-05-30T04:15:51+00:00

I have a question about link control system in PHP. The idea is to

  • 0

I have a question about “link control system” in PHP. The idea is to make script that could make different links than original – something like friendly links with .htaccess. In .htaccess make rule to redirect all traffic to script file – for example linkprocessor.php then in this file should be some conditions, mysql connect and pattern grabber from database(friendlyurl and originalurl columns). So if we write full address – example.com/defined-address it will redirect us(but not change address) to linkprocessor.php and then script is checking if /defined-address is in database, if is it will include certain(based on friendlyurl) originalurl file. Is that script would be optimal? That script could prevent from “hackers”.

Example:

example.com/defined-address -> linkprocessor.php -> SELECT originalurl from table WHERE friendlyurl = /defined-address -> include originalurl

=> can be written incoherently but its hard to explain that precisely

  • 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-05-30T04:15:53+00:00Added an answer on May 30, 2026 at 4:15 am

    What you are asking about here is the Front Controller pattern http://en.wikipedia.org/wiki/Front_controller.

    There are various ways to implement it, using a sql database to map URI strings to files to include is a valid way to do it, but might be overkill. The same information could probably be hard coded in a php array.

    The standard way to prevent hackers is to only allow whitelisted files to be included. In your case you are using an explicit map to determine which page to include, so it is not an issue.

    Some code to get you started:

    <?php
    
    $map = array('/home' => 'included_1', '/details' => 'included_2' ... )
    
    if (array_key_exists($_SERVER['REQUEST_URI'], $map)) {
        include $map[$_SERVER['REQUEST_URI']]
    }
    else {
        // Send a 404 response
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a question about asp : i have a list of ids that
Hey, here is the example I have a question about. I have a link:
I have question about NSView: Imagine a Custom View where the mouseDown, mouseDrag and
I have question about normalization. Suppose I have an applications dealing with songs. First
I have a question about using streams in .NET to load files from disk.
I have a question about best practices regarding how one should approach storing complex
I have a question about locking. This doesn't have to be only about record
I have a question about how to deploy WPF application into a PC without
I have a question about using os.execvp in Python. I have the following bit
I have a question about using new[] . Imagine this: Object.SomeProperty = new[] {string1,

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.