【发布时间】:2015-01-04 20:56:51
【问题描述】:
我在子域上使用 Slim 路由器时遇到问题。 路由器本身工作,我可以调用它,它不会导致任何错误,但 Slim 只是读取“/”路由。
文件夹
www
--- .htacccess
--- index.php
--- 其他东西
--- 子域
--- --- .htaccess
--- --- index.php
--- --- 其他东西
在 www/.htaccess 中:
重写引擎开启
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} !^..subdomain.example.de.
重写规则 ^ index.php
在子域/.htaccess 中:
重写引擎开启
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
在子域/index.php 中:
需要“供应商/自动加载”
$app = new Slim\Slim();
$app->get('/', function () {
回声'什么都没有';
});
$app->get('/foo', function() {
回声'酒吧';
});
$app->run();
所以,当我打开 www.subdomain.example.com/foo 时,我得到“什么都没有”。 我认为问题是重写,但我不知道如何解决它。
感谢您的帮助。
乔希
【问题讨论】:
标签: php .htaccess mod-rewrite url-rewriting slim