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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:27:22+00:00 2026-05-27T05:27:22+00:00

I have a site I’m working on with a /landing-page/ folder, and I’ll be

  • 0

I have a site I’m working on with a /landing-page/ folder, and I’ll be making a number of landing pages. I’d like to be able to put urls that have /lp/ instead of /landing-page/ in advertisements, and have any url with /lp/ in it replaced with /landing-page/.

Thus:
http://www.site.com/lp/ipad-inspections
would automatically redirect to:
http://www.site.com/landing-page/ipad-inspections

I would like to do this without having a /lp/ folder and a second page corresponding to each landing page. My thought is to have the 404 page check the url and redirect, but I can’t seem to get the following to work:

<?php /* Automatic redirect for landing pages */
$current_loc = $_SERVER['REQUEST_URI'];
$short_lp = '/lp/';
$long_lp = '/landing-page/';
if (strpos($current_loc, $short_lp)) {
    $current_loc = str_replace($short_lp, $long_lp, $current_loc, 1);
    header("location: ".$current_loc);
}

What am I doing wrong here, that my page is coming up blank? I have narrowed it down to the first line in my if statement, which is crashing my page.

If there a better way to do this with apache? Some line I can put in htaccess, maybe?

  • 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-27T05:27:22+00:00Added an answer on May 27, 2026 at 5:27 am
    RedirectPermanent /lp /landing-page
    

    in your .htaccess should do the trick. Best to do this sort of unconditional redirect BEFORE it reaches the PHP stage. It’s essentially a “free” operation in Apache, and saves your server the whole parse/compile/execute PHP stages.

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

Sidebar

Related Questions

I have a site with multiple pages, and each page has a table that
So I have site list on certain pages that basically just have links to
I have site that I want to look like this: but instead it looks
I have site culture in URLs like this: routes.MapRoute( Default, {language}/{controller}/{action}/{id}, languageDefaults, languageConstraints) And
I have site that has many links to its pages. And I will completely
I have site that works fine but when i put it through Google translate
I have site which uses $(selector).load(path) function in more than 300 pages. Now my
I have site I am working on and the images take forever to load,
For example I have site http://localhost/site In IIS I set that 404 error causes
I have a site that i want to redirect all requests accept for 1

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.