APACHE .htaccess – Giving WordPress Its Own Directory With Main App

htaccess for WordPress within a subfolder or subdirectory and keep your custom PHP site or framework

When the following instructions were applied from, https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory, my main website’s home page continued to work properly, though all child links routed to apache’s default 404 Not Found page.  Our links get a 404 Not found, because there are simply no existing files there to serve those URI requests. Everything on our primary domain points to a single index file. We’ll call the file main.php for your reference.

If you run a custom website that also serves your internal links and you would like to preserve your core functionality, and serve WordPress in a subdirectory, try these instructions instead.

NOTE: If this .htaccess configuration works for people, I encourage them to cite my article when sharing this configuration method.



RewriteEngine on
# For default app or website in root
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com/$
RewriteCond %{REQUEST_URI} /
RewriteRule ^main\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /main.php
# Snippet of WordPress instructions as directed at their codex
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com/$
RewriteCond %{REQUEST_URI} ^/blog
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /blog/$1
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com/$
RewriteRule ^(/)?$ blog/index.php [L]
This is the .htaccess code snippet to be installed at your root directory of your custom website or whichever app is located at root. The IfModule conditional element tags for modrewrite.c have been left out here for the sole purpose of publishing in this blog.



^main\.php$” & “main.php” point to the site’s main DirectoryIndex or handler file for internal routes. Replace main with the filename of your index file.

Replace “mydomain.com” with your real-life domain name. Be sure to find and replace all applicable instances of mydomain.com with yours.

blog” represents the subdirectory names. In a WordPress subdirectory installation, this is where you store and/or extract your WordPress files.

Hope this helps somebody. If you need any break / fix / custom / advanced web or wordpress work, please visit our WEBSITE.


Windows 10 – Helpful Tips for fixing or repairing Microsoft Windows Store apps

Corrupted or Glitchy Windows Tiles in new Start Menu???

 Start Menu and Windows App Beheaviour – Not Appearing

I was having a lot of issues on my Windows 10 PC. Most of the standard apps, like Weather, Xbox, and Microsoft Store would abruptly exit. There are lots of resources on the net which aim to repair this problem simply by copying/typing the following into powershell. I am writing this for other techs so they can read this and try this out on their own systems. Please do not hold me accountable if you run into issues….Here’s what I did…:

Get-AppXPackage -Users | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}

Basically, what’s happening here is that all registered Windows app configuration data is read and then the data found is used to reregister a fresh app instance for each app found in the “Users\AppData” folder based on the system’s default user account & other system folders.

This fix repairs the issue in the when clicking the Start button and no Start menu appears.

Check “Users” Folder Junctions

A machine I was using was also having a permissions issue in the ‘Application Data’ shortcut or junction of the user’s “AppData\Local” folder. The lack of junction points was causing the above command or similar commands to iterate through ‘Application Data’, resulting in duplicates AppData\Local\Application Data\Application Data\Application Data\Application Data\.

The solution to this is to navigate to all your Application Data shortcuts with ‘hidden file’ viewing enabled, right-clicking, hitting properties and the security tab, then disabling inheritance and removing all access to these and hitting ok. This might cause issues with legacy applications….but all worked for me…

If you simply try running the Add-AppXPackage command from within a powershell loop alone and hope that it works, it might unless if have permission issues on the machine. If you are reading this and can take on the challenge, I recommend giving this a shot before you obliterate your whole machine by formatting and reinstalling Windows.

If permissions are the issue…

Generally, a system with file permission problems is caused by users or IT technicians in error. You should use the following two commands to help repair Windows App issues if you believe file permissions are playing some sort of role with your Store Apps.

icacls "C:\Windows\SystemApps" /reset /T /C /Q

icacls "C:\Program Files\WindowsApps" /reset /T /C /Q