0

I have a WordPress site that is installed in a directory called cms.

I will be using a pure HTML page as my Home page, the inner pages will be using WordPress.

Let's call the website mysite.com

visiting mysite.com needs to show my plain html page.

The help I need is to hide the cms folder in the URL.

I have the following .htaccess file in my root

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteCond %{REQUEST_URI} !^/cms/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /cms/$1 
</IfModule>

And this .htaccess in side the cms directory:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cms/index.php [L]
</IfModule>

I don't think I need to have both but that is the only way I've gotten the pages to show up without an error.

For example lets say I have a page called MyPage

With how I have things set now it is accessible at:

mysite.com/MyPage AND mysite.com/cms/MyPage

I need it to only be accessible at mysite.com/MyPage

While maintaining the ability to serve the static HTML page at mysite.com

Any advice is appreciated!

  • have you considered using a page as the homepage with a page template? Or using home.php in your theme? Then you wouldn't need to have WP in a subfolder, and you wouldn't need a static HTML file – Tom J Nowell Jul 6 at 0:13
  • I would like to avoid having to do that if at all possible. Having the homepage completely outside of WordPress is preferable for the situation. – Jeremy King Jul 8 at 13:05
  • Keep in mind that copy pasting the static homepage into home.php gives you exactly the same result with no code changes, you'll have to provide more context of the situation, especially since HTAccess is a part of your question – Tom J Nowell Jul 8 at 17:21
  • If you think that is where my issues stem from I can try that approach. Having the homepage completely outside of the CMS is a request from the client, but I can work that out if necessary. I feel like what I'm trying to achieve in my OP should be possible however. – Jeremy King Jul 9 at 18:15

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.