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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:56:06+00:00 2026-05-30T07:56:06+00:00

I am working on a new script that basically instead when somebody searches for

  • 0

I am working on a new script that basically instead when somebody searches for something on my website how it normally goes to here:

http://domain.com/index.php?q=apples

to

http://apples.domain.com

I have made this work perfectly in PHP as well as htaccess but the problem I am having is using the original keyword afterwards on the new subdomain page.

Right now I can use parse_url to get the keyword out of the url but my script also filters out potential problems like:

public function sanitise($v, $separator = '-')
    {
        return trim(
            preg_replace('#[^\w\-]+#', $separator, $v),
            $separator
        );
    }

So if somebody searches for netbook v1.2

The new subdomain would be:

http://netbook-v1-2.domain.com

Now I can take the keyword out but it’s with the dashes and not original. I am looking for a way to send over the original keyword with the 301 redirect as well.

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-30T07:56:07+00:00Added an answer on May 30, 2026 at 7:56 am

    You can either just replace the hyphen with spaces when they visit the new subdomain or, since you’re on the same top-level domain, you can just cookie the keyword when redirecting them:

    setcookie('clientkeyword', 'netbook-v1-2.domain.com:netbook v1.2', 0, '/', '.domain.com');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the course of my career I've noticed that developers working on new functionality
Im new to working with Domain Models so forgive me for asking an elementary
When working on developing new software i normally get stuck with the redundancy vs
I am new here and got a question that is tricking me all day
I'm working on (what should be) a simple script that will add text to
I'm working at a complex script which could be processing upto 500,000 records. Here's
I'm working on a script that has gotten so complex I want to include
Im basically working on an image analyser that downloads images from another server. I
I am working on an application that is basically going to operate in a
In Git I can do this: 1. Start working on new feature: $ git

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.