https://github.com/neoxr/routergo
Simple PHP Router & No Need Composer
https://github.com/neoxr/routergo
Last synced: 2 months ago
JSON representation
Simple PHP Router & No Need Composer
- Host: GitHub
- URL: https://github.com/neoxr/routergo
- Owner: neoxr
- License: gpl-3.0
- Created: 2019-12-04T08:05:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-23T00:27:40.000Z (about 5 years ago)
- Last Synced: 2025-01-27T12:28:21.290Z (4 months ago)
- Language: PHP
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RouterGo
Simple PHP Router & No Need Composer## Config for .htaccess
Add this to your .htaccess
```
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php [QSA,L]
RewriteRule ^([^\.]+)$ $1.php [NC,L]
```## Config for lighttpd.conf
Add this to your lighttpd.conf
```
url.rewrite-once = (
".*\?(.*)$" => "/index.php?$1",
".*\.(php|ttf|otf|js|eot|woff2|woff|svg|ico|gif|jpg|png|css|html)$" => "$0",
"" => "/index.php",
)
```## How to use
default index
```
go('/', function() {
... your code
}
```and other page
```
go('/about', function() {
... your code
}go('/article/id/1', function() {
... your code
}
```