WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Fix for subdomains giving you 500 errors (1 post)

  1. lookslikepat
    Member
    Posted 3 years ago #

    This is a fix for a specific problem, that took me all in all 12 hours to discover a solution to, so I thought "I can't be alone in this..."

    Ok, the problem [I] had was this:

    I have my WP installed in the root folder / with the url like this: http://mydomain.com a.k.a. no www. - combined with pretty permalinks (and if it matters also WP Super Cache w/ rules inside the .htaccess file).

    After I installed WP, I setup a subdomain (outside of WP) at http://cdn.mydomain.com

    After a while, I discovered a problem: Anytime I linekd to my cdn suddomain, and wrote the wrong url, it didn't return a 404 error, instead it (the file I linked to) returned the content of cdn.mydomain.com/index.php - So no 404 errors of any kind.
    So my first thought, was to get rid of the index.php file. This instead made all (would have been) 404 errors into a 500 Internal server error instead.

    After some editing of the subdomains .htaccess file and then ttly resetting my subdomain, the problem still endured.
    So by then I knew it had to be WP, messing it up.
    After a good while googling, I stumbled upon this tip on stackoverflow, which solved it!!

    Turns out WP was "hijacking" all my subdomains requests, if they didn't point to an actual file.

    So here it is, one line (replace subdir-name w/ your subdomains name) that goes in your root folders .htaccess file, pref. at line 1, or before WP's rewrite rules.

    RewriteRule ^subdir-name/.*$ - [PT]

    So knowing this problem exists, souldn't [the user] be warned of this somehow, or atleast shouldn't this be pretty high up on the FAQ list?

Topic Closed

This topic has been closed to new replies.

About this Topic