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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:39:59+00:00 2026-05-23T22:39:59+00:00

I have a tricky rewrite situation where I am needing to rewrite old URL’s

  • 0

I have a tricky rewrite situation where I am needing to rewrite old URL’s that have parameters, to new URL’s, but at the same time appending the parameters of the old (now invalid) URL to this new URL.

Example: An old link of ring-details.php?product=MQ==&hash=376FGE367ER872CBD5 will now become rings/ring-detail/23.htm where the number 23 is actually the base64_decoded value of the product URL above.

So essentially I need to do this:

  • Check if the page being requested is ring-details.php and that there
    is a parameter ‘product’ present. Hash is no longer used.

  • Take the product parameters value (MQ==), base64_decode it

  • Append the decoded value to the new URL: rings/ring-detail/$1.htm
    where $1 is the decoded product URL parameter.

I am not asking to be spoon fed, but any hints or good resources would be great. 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-23T22:40:00+00:00Added an answer on May 23, 2026 at 10:40 pm

    As far as I know, you cannot decode Base64 in .htaccess/mod_rewrite. But you could make a workaround via PHP.

    So you have to catch the old URL and rewrite it to the PHP file, which decodes Base64 and redirects to the new URL.

    Content of .htaccess:

    RewriteEngine On
    RewriteCond %{QUERY_STRING} ^product=([^&]+)
    RewriteRule ring-details\.php$ redirect.php?product=%1 [L]
    

    Content of redirect.php:

    <?php
    header('Location: http://'.$_SERVER['HTTP_HOST'].'/rings/ring-detail/'.intval(base64_decode($_GET['product'])).'.htm', true, 301);
    ?>
    

    But actually you could modify ring-details.php instead and add this code at the very top:

    <?php
    if(!empty($_GET['product'])){
        header('Location: http://'.$_SERVER['HTTP_HOST'].'/rings/ring-detail/'.intval(base64_decode($_GET['product'])).'.htm', true, 301);
        exit;
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fairly new to SQL joins, but I have a tricky issue here.
I have a tricky problem that has had me scratching my head for a
my first time posting. I have a tricky task of finding the latest date
I have what I think is a tricky question, but hopefully someone on here
I have worked myself into a tricky situation and find myself unable to fight
I need to have custom checkboxes which wasn't that tricky. I made checkbox_selector to
I have 2 domains. For the question, I will call them www.old.com and www.new.com.
I'm fairly new to Visual Studio (specifically Visual Basic .NET) but have been programming
I have a tricky situation where I need to duplicate a table row, and
I have a tricky question. As everyone knows, Apple clearly says that ONE UIViewController

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.