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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:39:14+00:00 2026-05-24T10:39:14+00:00

I have a page that should be displayed slightly differently if users are coming

  • 0

I have a page that should be displayed slightly differently if users are coming from a particular link.

I.e.
The normal page is example.com/foo

If someone clicks on a link to example.com/foo-bar I want it redirected to example.com/foo, which can be done with the following line in a .htaccess file:

Redirect permanent /foo-bar /foo

I was planning to then using the following javascript to determine which page a user has come from:

<script type="text/javascript"> 
document.write(document.referrer);
</script> 

Which does print out the referrer URL if the user has come from a normal link on the site to /foo. But if they have clicked on a link to /foo-bar it prints out the URL of the page with the link, rather than the /foo-bar address that I need.

Is there a way to redirect a URL to another URL, and detect this on the page redirected to?

(Note that that the difference of content on the page isn’t critical, so if the 1% of users with javascript turned off see the wrong thing when they go to /foo-bar it wouldn’t be an issue.)

  • 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-24T10:39:14+00:00Added an answer on May 24, 2026 at 10:39 am

    change your redirection code to:

    Redirect permanent /foo-bar /foo#redirected
    

    and then in /foo:

    if( window.location.hash == 'redirected' ) {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my page I have a bunch (about 30) dom nodes that should be
In my web page, I have a menu ( HorizontalPanel ) that should be
I have a page that, depending on input from a previous page, lists a
I have one page (Products) that searches for products which are then displayed in
I have a php page displaying query results from mysql. This result is displayed
I have a page that takes a few minutes to run. When I set
I have a page that opens a modal dialog. After the operations done on
I have a page that has fields dynamically loaded via JQuery. It allows a
I have a page that loads a bunch of scripts to prepopulate dropdowns and
I have a page that displays a list with a of elements with a

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.