Hopefully this helps others who have a similar situation, I’ve searched and searched and cannot seem to find a solution. Perhaps I’m wording it wrong?

In short:

  1. Default posts should loop at /blog/ and the default posts to follow that path, /blog/post-title/
  2. A specific category should loop at /category/ and the posts of that category to follow that path, /category/post-title/
  3. Existing php site has functions and variables that the index.php needs to access, so it cannot run the theme engine for the homepage and doesn’t need to run any unnecessary database calls except just for the 2 latest articles

I assume the folder structure can be done with wordpress in the root of the site, but I’m not sure if themes can be disabled for the homepage only. All static page information I’ve found (I know, php is dynamic, not static. But I need to not use the theme on the homepage while being able to use it on wordpress generated posts) points to using the wordpress theme engine.

If it can be done with the API, I would need to know how to set up an automatic routing for the permalinks.

I will update this question if answers reflect a need for clarification. I appreciate everyone’s help and truly hope this can help other app developers and custom php site developers.

If there’s an alternate solution to wordpress in the root that makes the folder system above work properly, that is fine. I will mark whatever answer solves this problem as correct.

1 Answer
1

Short Answer

No.

The Reason

If you take a look at the .htaccess file in the root of your WordPress installation, you will notice these few lines generated by WordPress ( If you have pretty permalink enabled ):

# 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

Pay attention to line 5. When you make a request to a WordPress website, this rule will send it to index.php. But it appears that you want to eliminate index.php file. Even if you manage to do it via rewrite rules, there would be a million of other requests that are sent to this file by default. Not to mention this file is being used internally by WordPress.

Generally it’s not a good idea to have two CMS or platforms installed into a single directory.

What To Do?

What you can do is, to install your WordPress inside a sub-directory, and then use rewrite rules to eliminate /sub-directory/ from certain pages that you need.

Leave a Reply

Your email address will not be published. Required fields are marked *