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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:51:29+00:00 2026-05-19T23:51:29+00:00

Client asked me to automatically redirect any urls with a pound sign in them

  • 0

Client asked me to automatically redirect any urls with a pound sign in them to a version without a pound sign, but I don’t think I am detecting a # in any of my urls with this formula. I emailed myself a sample URL using the curPageURL() formula and it didn’t contain the trailing # sign in the url I was testing.

function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}

if(stripos($currenturl,'#'))
{
    Header( "HTTP/1.1 301 Moved Permanently" ); 
    $location = 'Location: ' . str_replace('#','',$currenturl) . '/';
    Header($location);
}

*Correction – I said at the end in the Title, and I mean the end, my code here apparantly detects for the pound sign anywhere in the url. *

  • 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-19T23:51:30+00:00Added an answer on May 19, 2026 at 11:51 pm

    The part after the # is a “hash” or “fragment”. It is entirely client-side – it is never sent to the server (and if it is, it results in an error). As such, your PHP script will never see it, and can’t therefore fix it. This is correct behavior, and by design.

    That said, you could check for the #fragment using a client-side solution (e.g. in JS with document.location.hash) and redirect from there.

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

Sidebar

Related Questions

I know it's a silly question but , My client asked for encrypting some
A client has asked for a page loader, something attractive to let the visitor
A client has asked me to make their YouTube channel look similar this one:
a client has asked me for a Facebook application similar to a news reader,
So i am building an application on flex for a client and he asked
I was asked to write a servlet that collects client's details such as ip,
I have been asked by a client to return a 410 Status code for
I have an client who uses Magento. They asked me to redesign the site
This could quite possibly be the dumbest question ever asked. Our client wants us
A client has asked me to add a simple spaced repeition algorithm (SRS) for

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.