1

Imagine a LAMP stack Wordpress installation running in the root of example.com, with a permalink structure like /section-1, /section-1/page-1, /section-2, etc.

I would like to have custom pages at /landingpage-1, /landingpage-2, etc. In other words, a limited set of urls that are being served through an independent Wordpress install on the same server, with a different look and feel.

I've seen approaches with .htaccess rewrite exceptions and custom php files that require wp-load.php from the second install, but I'm curious about your ideas.

Thanks in advance for your time!

Edit:

This is what I came up with so far, which is working pretty good:

// .htaccess changes
Options +MultiViews # render php files without php extension
RewriteCond %{REQUEST_URI} !^/landingpage$ # mod_rewrite exception so it doesn't get routed to the main wp install

// landingpage.php
define('WP_USE_THEMES', true);
require( 'wp2/wp-blog-header.php' );
$post = get_page_by_path( $_SERVER['REQUEST_URI'] ); // looks for the identical permalink at the second install (/template in this case)
$wp_query = new WP_Query( array( 'p' => $post->ID, 'post_type' => 'any' ) ); // gathers all post info using the post ID

// at this point you can do regular template things like get_header and the loop
  • 3
    So your actual problem is you want to have landing pages at URLs that don't look like your sites theme? Is there any other reason you would need a separate installation? Is there a particular reason a multisite subdirectory install will not work? – Tom J Nowell Feb 18 '16 at 20:06
  • The separate install is there to separate responsibilities. I would like to touch the existing install as little as possible, because it is created and maintained by another company. I'm exploring options. – bramchi Feb 19 '16 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.