I recently set up a subdomain within a CPanel hosting account and ran into a strange problem.
After the subdomain was built, DNS propogated, FTP access and a database set up – I uploaded the latest version of the ever propular WordPress blogging software. As the installation instructions suggested, about two minutes later WordPress was up and running. Unfortunately the image overlays for the TinyMCE rich text editor were not displaying correctly; the buttons were present but the overlay that depicts a capital B for bold or an I for italics were not showing.
Knocking off the simplest things first:
- CTRL+R and CTRL+F5 to force the browser to reload all content
- Cleared browser cache
- Uploaded the wp-includes folder again, in case any of the images failed to upload successfully
- Checked that I could view the images in question manually in the browser by typing in the URL, which worked
at this point I was beginning to draw a bit of a blank as to what it might have been.
As is often the case, I left the problem alone for a little while and the solution popped into my head. To enable the friendly URL’s within WordPress, I needed to either make the .htaccess file writable or upload one with the appropriate configuration in it. As a matter of simplicity, I copied the .htaccess file from the main WordPress installation on the site and dropped it into the subdomain installation. Copy and paste, the bain of all evil.
Back in May 2006, people from MySpace were hotlinking images from my site. The cost of popularity from my anonymous MySpace friends was pushing my web hosting account well over its monthly data limits and I was forced to block their access using some simple rules in my .htaccess file.
Since I copy and pasted my .htaccess file into the subdomain (which resides in a folder under the primary account) – the settings in the parent .htaccess file were inheriting into the subdomain account. The result was that any requests from the subdomain that didn’t meet the hotlinking requirements were being blocked by Apache and mod_rewrite.
The solution of course was straight foward, remove the restrictions in the .htaccess file that I had uploaded into the subdomain and suddenly the images from the WordPress admin and TinyMCE started showing up as you’d expect.
A work collegue of mine would term this a junior error.