I have an Apache webserver that hosts a site for my main domain (something.com). This works fine. I have a second domain (somethingelse.com), that I would like to point to a folder on my site, placed at something.com/somethingelse/. I have set up DNS so that both domains point to the webserver's IP, and by default both domains now display the frompage of something.com (the main site).
From here, I put in a .htaccess file, that looks like this:
RewriteCond %{HTTP_HOST} ^(www.)?somethingelse.com$
RewriteCond %{REQUEST_URI} !^/somethingelse/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /somethingelse/$1 [L]
RewriteCond %{HTTP_HOST} ^(www.)?somethingelse.com$
RewriteRule ^(/)?$ somethingelse/index.php [L]
This should cause any request to somethingelse.com to be pointed into the somethingelse-folder. This also works as expected.
However:
When I try to access somethingelse.com now, I get a 500 Internal Server error. This only happens if I use a PHP file. If I set it up with a file like index.html, it works.
I believe this has something to do with a hidden policy, that prevents PHP scripts from executing if the domain is somehow different from that of the main site (something.com), like some kind of CORS-protection. I have already checked the file permissions, and they are set up the exact same way as the rest of the site (and again, it does work with HTML-files).
So - I may know what the problem is here, but how do I fix it?
(The error cannot come from the PHP script itself, as there is no PHP code in the file at all. The .php-extension alone is causing this problem.)