How can I have nginx serve WordPress at /blog?

Here’s what mostly works: Have an nginx config file for the subdomain setup, and ensure that http://wordpress.example.com works. In the nginx default config, have a location block for /blog that proxies to the subdomain: location /blog { rewrite ^/blog(/?.*)$ $1 break; # remove “/blog” proxy_set_header Host wordpress.example.com; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://wordpress.example.com; } In wp-config.php, … Read more

Multisite setup help – plain domain/subsite always redirects to domain with subdir multisite

You’re close. I added a few more places to capture more scenarios and used the HTTP_HOST variable in the rule. The $1 is not needed in the condition as that would match what’s captured in the above condition. <IfModule mod_rewrite.c> RewriteEngine On Rewritecond %{HTTP_HOST} !^www\.(.*)$ [NC] RewriteCond %{REQUEST_URI} ^/subsite/? [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301] </IfModule> … Read more

get_query_var not working for subdirectory

You shouldn’t use get_query_var for getting the pagename (slug) – there is no guarantee that pagename will be set, depending on your permalink structure (or lack thereof). Instead, check if the request is for a page, and then get the slug directly from the queried object: if ( is_page() ) { $slug = get_queried_object()->post_name; }

Drawbacks to using Options -Indexes

There are some legitimate use cases for enabling Indexes but they’re probably not applicable to most sites (especially WordPress sites). For example Indexes are helpful on file storage mirrors where you want to provide readonly access to a subset of folders & files without having to build your own UI. As a best practice, yes, … Read more

Theme in wp-content but my index.php search theme files in root

I assume you are adding your stylesheets like this in your header: <link rel=”stylesheet” type=”text/css” href=”https://wordpress.stackexchange.com/questions/285785/css/style.css”> Which won’t work. To construct the path dynamically, you need to use the PHP functions offered for this. Make sure your header has <?php wp_head(); ?> in it, and then enqueue your style in your theme’s functions.php file as … Read more

Change directory of javascript files

go to your themes functions.php and find line 122. You will find navigation.js function. get_template_directory_uri() . ‘/js/navigation.js and change it to get_template_directory_uri() . ‘assets/js/navigation.js do it again for skip-link-focus-fix.js code located on line 124. For customizer go and find customizer.php in ‘inc’ folder. Go line 53 and change js/customizer.js code to assets/js/customizer.js Don’t forget to … Read more