Routes for React
This commit is contained in:
parent
20db2301cb
commit
06ce614c2b
@ -11,11 +11,11 @@ RewriteRule ^ api/index.php [L,NC,QSA]
|
|||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !/api/docs
|
RewriteCond %{REQUEST_FILENAME} !/api/docs
|
||||||
RewriteCond %{REQUEST_FILENAME} !/dist
|
RewriteCond %{REQUEST_FILENAME} !/dist
|
||||||
RewriteRule ^ dist [L,NC,QSA]
|
RewriteRule ^ dist/index.html [L,NC,QSA]
|
||||||
|
|
||||||
## Rewrite all files unless in the directories specified
|
## Rewrite all files unless in the directories specified
|
||||||
RewriteCond %{REQUEST_FILENAME} -f
|
RewriteCond %{REQUEST_FILENAME} -f
|
||||||
RewriteCond %{REQUEST_FILENAME} !/storage/.*
|
RewriteCond %{REQUEST_FILENAME} !/storage/.*
|
||||||
RewriteCond %{REQUEST_FILENAME} !/dist/.*
|
RewriteCond %{REQUEST_FILENAME} !/dist/.*
|
||||||
RewriteCond %{REQUEST_FILENAME} !/api/docs
|
RewriteCond %{REQUEST_FILENAME} !/api/docs
|
||||||
RewriteRule ^ dist [L,NC,QSA]
|
RewriteRule ^ dist/index.html [L,NC,QSA]
|
||||||
@ -8,21 +8,25 @@ class Input
|
|||||||
{
|
{
|
||||||
public static function post(string $index, $defaultValue = null)
|
public static function post(string $index, $defaultValue = null)
|
||||||
{
|
{
|
||||||
return Request::request()->getInputHandler()->post($index, $defaultValue);
|
$value = Request::request()->getInputHandler()->post($index, $defaultValue);
|
||||||
|
return empty($value) ? null : $value->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function patch(string $index, $defaultValue = null)
|
public static function patch(string $index, $defaultValue = null)
|
||||||
{
|
{
|
||||||
return Request::request()->getInputHandler()->post($index, $defaultValue);
|
$value = Request::request()->getInputHandler()->post($index, $defaultValue);
|
||||||
|
return empty($value) ? null : $value->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get(string $index, $defaultValue = null)
|
public static function get(string $index, $defaultValue = null)
|
||||||
{
|
{
|
||||||
return Request::request()->getInputHandler()->get($index, $defaultValue);
|
$value = Request::request()->getInputHandler()->get($index, $defaultValue);
|
||||||
|
return empty($value) ? null : $value->getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function file(string $index, $defaultValue = null)
|
public static function file(string $index, $defaultValue = null)
|
||||||
{
|
{
|
||||||
return Request::request()->getInputHandler()->file($index, $defaultValue);
|
$value = Request::request()->getInputHandler()->file($index, $defaultValue);
|
||||||
|
return empty($value) ? null : $value->getValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
exam/dist/.htaccess
vendored
6
exam/dist/.htaccess
vendored
@ -1,7 +1,7 @@
|
|||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
RewriteBase /phpCourse/exam/dist/
|
RewriteBase /phpCourse/exam/dist
|
||||||
|
|
||||||
## Frontend routing required all non files to be rewritten to the entry point
|
## Disallow direct entry over the dist
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteRule ^ index.html [L,NC,QSA]
|
RewriteRule ^ / [L,NC,QSA,F]
|
||||||
Loading…
x
Reference in New Issue
Block a user