Reputation: 41
i have a Problem using the Router Slim on a Subdomain. The router itself works, i can call it and it doesn't cause any errors, but Slim just reads the "/" Route.
the Folders
www
--- .htacccess
--- index.php
--- other Stuff
--- subdomain
--- --- .htaccess
--- --- index.php
--- --- other Stuff
in www/.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{HTTP_HOST} !^..subdomain.example.de.
RewriteRule ^ index.php
in subdomain/.htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
in subdomain/index.php :
require 'vendor/autoload'
$app = new Slim\Slim();
$app->get('/', function () {
echo 'nothing';
});
$app->get('/foo', function() {
echo 'bar';
});
$app->run();
So, when i open www.subdomain.example.com/foo i get 'nothing'. I think the Problem is the rewriting, but i dont know how to fix it.
Thanks for any help.
josch
Upvotes: 2
Views: 2240
Reputation: 41
I got this solved with the following in subdomain/.htaccess
:
RewriteEngine On <br>
RewriteBase /dev-project/
RewriteCond %{REQUEST_FILENAME} !-f<br>
RewriteRule ^(.*)$ /index.php [QSA]
Upvotes: 2