首页 文章

如何在子域上重写Slim的url

提问于
浏览
2

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


文件夹

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


在www / .htaccess中:

RewriteEngine On RewriteCond%!-f RewriteCond%!^ .. subdomain.example.de . RewriteRule ^ index.php


在子域/ .htaccess中:

RewriteEngine On RewriteCond%!-d RewriteCond%!-f RewriteRule ^( . *)$ index.php [QSA,L]


在subdomain / index.php中:

require'proflier / autoload'$ app = new Slim \ Slim(); $ app-> get('/',function(){echo'tone';}); $ app-> get('/ foo',function(){echo'bar';}); $ APP->运行();


所以,当我打开www.subdomain.example.com/foo时,我得到'没事' . 我认为问题是重写,但我不知道如何解决它 .

谢谢你的帮助 .
josch

1 回答

  • 1

    我在 subdomain/.htaccess 中解决了以下问题:

    RewriteEngine On <br>
    RewriteBase /dev-project/
    
    RewriteCond %{REQUEST_FILENAME} !-f<br>
    RewriteRule ^(.*)$ /index.php [QSA]
    

相关问题