WordPress Network Setup Offers Broken URL Rewrite Rules

Conditions:

This was repeated with WordPress 3.5.1 installed on shared Linux apache hosting. The hosting account supported multiple domains, with each domain running from a subfolder of the hosting acccount’s web server document root. No attempt to repeat this behavior was attempted with shared Windows hosting.

  • For example, the web server document root was:
/some/number/of/folders/html/
  • And http://domain.tld/ was set up to run from:
/some/number/of/folders/html/domain/index.php
  • Now we wanted to use WordPress on domain.tld, AND we also wanted the core files in a subfolder as in:
/some/number/of/folders/html/my-domain/wordpress/

WordPress is installed to the above folder. If WordPress can’t write to .htaccess or web.config files, WordPress proposes the required URL ReWrite code. Either way, .htaccess or web.config is configured to rewrite incoming HTTP requests, so the web server can find the requested files. Testing the new site, you encounter the following symptom.

Symptom:

  • Your WordPress site appears, but is rendered without any style. If the site does not render at all, you have other issues to solve.
  • You might also notice javascript is non-functional
  • Inspection of HTTP headers, using tools built into your browser, reveals numerous 404 errors

Cause:

  • URL Rewrite not working because it is miss configured through no fault of your own

In Single Site mode, WordPress Dashboard -> Settings -> Permalinks -> Save Changes, or
in Network mode, WordPress Network Admin Dashboard -> Settings -> Network Setup,
may offer incorrect url rewrite rules

Is this only on apache???????????????????????

WordPress rightly or wrongly finds the root folder that should be available to the web server, so an extra folder is appended to the rewrite rules, which breaks url rewrite that WordPress.depends on.

Hack:

Edit your .htaccess or web.config, removing the offending folder from the rewrite condition

 

Leave a comment

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

+ 74 = 80