dtbc37573 2016-04-02 14:49
浏览 26

从另一个域运行PHP脚本时出现500错误

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.)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号