I use Slim php framework to build some action inside index.php page: so this is the way I call my action:
index.php/action1
$app->get('/action1',function () use ($app){
echo "this is action 1";
});
index.php/action2
$app->get('/action2',function () use ($app){
echo "this is action 2";
});
Now I want my url become pretty , such as when type in index/action1
, it will redirect to index.php/action1
Please provide me the solution in creating htaccess to do that
Thank and best reagard
Create .htaccess
file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
user group to prefix your route
$app->group('/index', function () use ($app) {
/**
* Route GET /index/action1
*/
$app->get('/action1',function () use ($app){
echo "this is action 1";
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.