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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:26:25+00:00 2026-06-10T18:26:25+00:00

I would like to do if somebody adds a hex value at the end

  • 0

I would like to do if somebody adds a hex value at the end of the URL, I can show them a certain page.

For example, say I have colors.com, I would like it so if somebody want to go to colors.com/FF0000, it would display that hex on the page. Is it possible to grab it from the URL and display it although I would like it to be hex values only.

Remove certain letters and special characters so somebody can’t just use text.

Hope that makes sense.

  • 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-10T18:26:27+00:00Added an answer on June 10, 2026 at 6:26 pm

    You would need to use your web server’s URL rewriting to match patterns which look like hex colors (6 letters A-F and digits 0-9) and route accordingly.

    Apache mod_rewrite example to silently rewrite example.com/AA00FF to example.com/index.php?color=AA00FF:

    RewriteEngine On
    # [A-Fa-f0-9]{6} matches six letters A-F and digits 0-9.
    RewriteRule ^([A-Fa-f0-9]{6})$ index.php?color=$1 [L]
    

    In your PHP script index.php, retrieve it from $_GET['color']. You will need to validate it in PHP for that regex as well. Otherwise, you risk XSS attacks:

    // You MUST validate it in PHP as well, to avoid XSS attacks when you insert it into HTML
    if (preg_match('/^[A-Z0-9]{6}$/i', $_GET['color'])) {
      // ok to use
    }
    else {
      // Invalid hex color value. Don't use it!
    }
    

    I’m not saying this is a good idea, but to set the body color, you can then just do:

    // Last warning: DON'T DO THIS UNLESS YOU HAVE VALIDATED WITH THE REGEX ABOVE!
    echo "<body style='background-color: #{$_GET['color']}'>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hoping somebody can help me out - I would like to replace a certain
Could somebody help me.I would like to get substring of string by ant.For example
I would like somebody to give me an example code to parse only the
Can somebody help me please, I have this code : $('childcat').setHTML('Loading...'); I would like
How can I achieve a result like somebody would expect it according to the
I would like to send an email from a magento/php form. Can somebody please
Can somebody help me please? I would like to replace 'text' words with 'TEXT'
I would like to know if somebody knows a library where I can create
Can somebody please help me with this difficulty I am having? I would like
Would like a for loop in jquery so that: For every hover_link: show hidden

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.