Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在子域上重写Slim的url_Php_.htaccess_Mod Rewrite_Url Rewriting_Slim - Fatal编程技术网

Php 如何在子域上重写Slim的url

Php 如何在子域上重写Slim的url,php,.htaccess,mod-rewrite,url-rewriting,slim,Php,.htaccess,Mod Rewrite,Url Rewriting,Slim,我在使用子域上的路由器Slim时遇到问题。 路由器本身可以工作,我可以调用它,它不会导致任何错误,但Slim只读取“/”路由 文件夹 www ---.htaccess ---index.php ---其他东西 ---子域 ------.htaccess ------index.php ------其他东西 在www/.htaccess中: 重新启动发动机 重写cond%{REQUEST_FILENAME}-f 重写cond%{HTTP_HOST}!^。。子域.example.de. 重写规则

我在使用子域上的路由器Slim时遇到问题。 路由器本身可以工作,我可以调用它,它不会导致任何错误,但Slim只读取“/”路由


文件夹

www
---.htaccess
---index.php
---其他东西
---子域
------.htaccess
------index.php
------其他东西


在www/.htaccess中:

重新启动发动机
重写cond%{REQUEST_FILENAME}-f
重写cond%{HTTP_HOST}!^。。子域.example.de.
重写规则^index.php


在子域/.htaccess中:

重新启动发动机
重写cond%{REQUEST_FILENAME}-d
重写cond%{REQUEST_FILENAME}-f
重写规则^(.*)$index.php[QSA,L]


在subdomain/index.php中:

需要“供应商/自动加载”
$app=new Slim\Slim()

$app->get('/',函数(){
呼应“没什么”;
});

$app->get('/foo',function(){
回声“条”;
});

$app->run()


所以,当我打开www.subdomain.example.com/foo时,我得到的是“什么都没有”。 我认为问题在于重写,但我不知道如何修复它

谢谢你的帮助

josch

我在
子域/.htaccess
中解决了这个问题:

RewriteEngine On <br>
RewriteBase /dev-project/

RewriteCond %{REQUEST_FILENAME} !-f<br>
RewriteRule ^(.*)$ /index.php [QSA]
重新启动引擎
重写基础/开发项目/ 重写cond%{REQUEST_FILENAME}-f
重写规则^(.*)$/index.php[QSA]
什么是开发项目?子域中的目录?