Forum Discussion
Running WordPress from a Subfolder in Azure App Service - Not Working
I’m running into an issue with my Azure App Service deployment. I have a primary PHP site running smoothly from the root directory, but I'm having trouble getting a WordPress blog to work from a subfolder (e.g., https://mydomain.com/blog).
Despite ensuring that all WordPress files are correctly placed in the site/wwwroot/mysite/blog directory, accessing https://mydomain.com/blog results in a "Not Found" error.
Here are a few details about my setup:
The primary site is a custom PHP application.
The application is running on Linux.
The WordPress files are located in site/wwwroot/mysite/blog.
I've verified that the subfolder and its contents are accessible via FTP.
The main site and the blog use same databases.
- I have set WORDPRESS_MULTISITE_CONVERT = true and WORDPRESS_MULTISITE_TYPE = subdirectory in the Environment Variables.
- .htaccess file looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
Has anyone encountered a similar issue or have any insights on how to successfully run a WordPress site from a subfolder in Azure App Service? Any tips or configuration changes that I might be missing would be greatly appreciated!
1 Reply
define( 'WP_HOME', 'https://mydomain.com/blog' );
define( 'WP_SITEURL', 'https://mydomain.com/blog' );Update .htaccess File
Your current .htaccess file looks almost correct, but it may need to be adjusted for Azure's Linux environment.
Try this configuration:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]Redirect everything else to the correct subdirectory.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPressCheck Azure App Service Path and Folder Structure
Ensure the folder structure is correctly set up on Azure App Service:
- WordPress files should be inside the /site/wwwroot/mysite/blog folder.
- Confirm that your Azure app is running PHP properly, and all necessary PHP extensions for WordPress are enabled (e.g., mod_rewrite for URL rewriting).
define( 'WP_ALLOW_MULTISITE', true );
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', false ); // Set to false for subdirectories
define( 'DOMAIN_CURRENT_SITE', 'mydomain.com' );
define( 'PATH_CURRENT_SITE', '/blog/' ); // Ensure this is set correctly
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );File Permissions
Make sure that the file permissions are correct for the /blog directory and its contents:
- Use FTP or Azure CLI to ensure files have the correct permissions (e.g., 755 for directories and 644 for files).
Check that the wp-config.php file and other critical files have the appropriate permissions.