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 6384815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:49:19+00:00 2026-05-25T02:49:19+00:00

I am about to attempt writing of a photo sharing script and a script/rewrite

  • 0

I am about to attempt writing of a photo sharing script and a script/rewrite that transforms numbers into descriptive names. I have a vague idea on how to go about doing this, so I was looking for some general comments/guidance.

Issue 1: I need to have a URL source for a photo which is stored above my root directory. I plan on appending the photo name (which is stored in my database) to my url as a query string, such as: http://www.mywebsite.com/getphoto.php?12_3.jpg and then writing a php script (getphoto.php) which takes the portion after the ‘?’ and gets that photo from above the root.

Does this make sense and would there be any things to consider?

Issue 2: I want to transform a number at the end of my URL to a descriptive name (ie typing in facebook.com/4 displays facebook.com/zuck). I am not really sure the best way to go about doing this and was hoping for some guidance to get going in the right direction.

Thanks!

  • 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-25T02:49:20+00:00Added an answer on May 25, 2026 at 2:49 am

    For Issue 1: a simple rewrite can handle that, you need to use the [QSA] flag. Something like this:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^.*\.(jpeg|jpg|gif|png|bmp)$
    RewriteRule ^(.+)$ /getphoto.php?photo=$1 [L,QSA]
    

    This will rewrite behind the scenes the url http://mywebsite.com/12_3.jpg to http://mywebsite.com/getphoto.php?photo=12_3.jpg Note that the 3rd rewrite condition wants the URI to end with an image extension, you may not need it.

    For Issue 2, it depends on how something like “4” maps to “zuck”. If you are going to hardcode them into your apache config, you can use a RewriteCond:

    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/4$
    RewriteRule ^.*$ /zuck [L]
    RewriteCond %{REQUEST_URI} ^/5$
    RewriteRule ^.*$ /mark [L]
    

    etc. (or replace [L] with [R,L] to redirect instead of rewrite, or alternatively just use Redirect)

    Redirect /4 /zuck
    Redirect /5 /mark
    

    etc.

    If the mapping is stored in a database, your going to need to do this dynamically, perhaps as a php script to do a redirect, utilizing something similar to Issue 1. The rewrite rule would rewrite to something like /redirect.php?id=$1 and your redirect.php script would take the id and do a database lookup to see where to redirect the browser.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm about to start writing a program which will attempt to extract data from
I have 2 XML files that I would like to include into a project
After reading a book on LINQ I'm thinking about re-writing a mapper class that
I'm about to have to rewrite some rather old code using SQL Server's BULK
About to create a form using Zend Form, all the form elements should have
After developing software for about 5 years now, I have spent probably atleast 20%
I'm re-writing a website that will support multiple skins. Currently, I'm just planning on
Hi I'm writing MySQL requests for a database that I didn't design, and cannot
I'm writing this cURL script in PHP. It's purpose is to take a product
I'm writing some code for activating neural networks on CUDA, and I'm running into

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.