1
votes
  1. I installed WordPress to a sub directory: example.com/wp

  2. I use a rewrite rule to serve WordPress from my root URI: example.com

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
  1. I want to provide a welcome page for project launch: example.com/welcome.html

It will have a simple welcoming message and should redirect to a working version of my WordPress. I do have pretty URLs enabled in WordPress. From my welcome.html page I can link to example.com/about, for example, and it will show the about page of my WordPress (as expected).

However, I cannot link to the home page of my WordPress. I use a static page for my WordPress front page (let's call it start). When I link to example.com/wp, it will issue an error 404 in my WordPress. When I link to example.com/start, it will redirect to my welcome.html page.


Sounds confusing? Hope you are still with me. What I actually want:

a) Users that directly access example.com should see the welcome page.

b) They click a link on the welcome page and get to my WordPress home.

c) When navigating within WordPress, they should not be redirected to the welcome page.

Since I want to remove the welcome page after a couple of weeks, I want to keep it as simple as possible (no new front page template for WordPress or alike).

Is there any solution to set welcome.html as my DirectoryIndex and make all other requests redirect to my WordPress installation including the WordPress home? My major problem is that I cannot access the WordPress home page right now (neither example.com/wp, nor example.com/start or example.com/wp/start work), unlike any other static page (example.com/about works fine).

1

1 Answers

1
votes

I finally ended up using this one-line plugin to disable canonical URL redirects:

<?php remove_filter('template_redirect', 'redirect_canonical'); ?>

Furthermore, I reconfigured the WordPress URI on the General settings panel. Now I can both, call the home page of my blog and access all sub-pages, without being redirected to an error 404.

Now I'll have my .htaccess do a DirectoryIndex welcome.html, so my visitors see the splash page first. The welcome page has a link to my index.php page which serves WordPress. All links within the blog work.

When my project is launched, I will simply remove the DirectoryIndex, delete the above plugin code and reset my General settings.