Added .htaccess example to documentation (issue #232)

This commit is contained in:
Simon Sessingø
2017-05-09 02:31:01 +02:00
parent 0a58d36606
commit 50e8926272
2 changed files with 17 additions and 3 deletions
+14
View File
@@ -155,6 +155,20 @@ location / {
Nothing special is required for Apache to work. We've include the `.htaccess` file in the `public` folder. If rewriting is not working for you, please check that the `mod_rewrite` module (htaccess support) is enabled in the Apache configuration.
#### .htaccess example
Below is an example of an working `.htaccess` file used by simple-php-router.
Simply create a new `.htaccess` file in your projects `public` directory and paste the contents below in your newly created file. This will redirect all requests to your `index.php` file (see Configuration section below).
```
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-l
RewriteRule ^(.*)$ index.php/$1
```
### Configuration
Create a new file, name it `routes.php` and place it in your library folder. This will be the file where you define all the routes for your project.
+3 -3
View File
@@ -77,10 +77,10 @@ class RouterRouteTest extends PHPUnit_Framework_TestCase
public function testPathParamRegex()
{
TestRouter::get('/test/path/{myParam}', 'DummyController@param', ['where' => ['myParam' => '([0-9]+)']]);
$response = TestRouter::debugOutput('/test/path/123123', 'get');
TestRouter::get('/{lang}/productscategories/{name}', 'DummyController@param', ['where' => ['lang' => '[a-z]+', 'name' => '[A-Za-z0-9\-]+']]);
$response = TestRouter::debugOutput('/it/productscategories/system', 'get');
$this->assertEquals('123123', $response);
$this->assertEquals('it, system', $response);
}
public function testDomainAllowedRoute()