Reputation: 711
I download Silex because I want to try it in my next project. I'm using mamp under Windows 8.1 64x , I think that this doesn't matter but, anyway, I put Silex into C:\mamp\htdocs\projectfolder\ (http://locahost/projectfolder/)
This means that I got http://locahost/projectfolder/vendor
and http://locahost/projectfolder/web/
I wrote this .htaccess under "web" directory
Options -MultiViews
RewriteEngine On
RewriteBase /projectfolder/web
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
It works perfect if I come into http://locahost/projectfolder/web/hello
, but I want to come from /projectfolder/, so I created a new htaccess file in /projectfolder with this content:
Options -MultiViews
RewriteEngine On
#RewriteBase /projectfolder
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ web/index.php [L]
But when I run it, the app retun an NotFoundException: Sorry, the page you are looking for could not be found.
Thanks in advance
Upvotes: 2
Views: 1049
Reputation: 1582
I'm new to silex too, so if anyone has better insights please tell/teach us :)
I decided to create a project on a separate folder from silex and, what I did was, I created a new index.php requiring silex's autoload.php and a new .htaccess which is basically the same.
So, I have this structure:
/myproject/silex/
/myproject/app/
/myproject/app/index.php
/myproject/app/.htaccess
my .htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
</IfModule>
and my index.php
<?php
require_once __DIR__.'/../silex/vendor/autoload.php';
...
BTW, I configured a vhost to point to /myproject/app/
Hope this helps.
Upvotes: 3