我有以下结构:
/home/
alvaro/
public_html/
Code Playground/
SlimTest/
logs/
public/
src/
templates/
vendor/
...
http://example.com
指向/home/alvaro/public_html
,因此http://example.com/Code Playground/SlimTest
指向/home/alvaro/public_html/Code Playground/SlimTest
,我已放置此.htaccess
文件的目录:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
简而言之,在浏览器中加载http://example.com/Code Playground/SlimTest
会执行我的/home/alvaro/public_html/Code Playground/SlimTest/public/index.php
Slim / 3.9.0(纤细/细长骨架)入口点。
我的问题是我无法正确路线。我尝试了所有可能的组合:
$app->get('/Code Playground/SlimTest', …);
$app->get('/Code Playground/SlimTest/', …);
$app->get('/Code Playground/SlimTest/public', …);
$app->get('/', …);
// …
...但我总是得到Slim的NotFound
课程提供的 404 Not Found 页面。
有没有办法在路线定义时获得基本路径,以便我可以在get()
中添加前缀?
如果没有,硬编码路径会是什么样的?
我应该在Apache中查找修复程序,例如Alias吗?