Hi I have a LEMP Server and I have used .htaccess file as bellow to redirect empty directories to index.php but the problem is that it's not executing the code in the index.php it's just printing the Array()
.htaccess file
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?path=$1 [NC,L,QSA]
nginx server configuration
server {
listen 80;
root /storage/html/stream;
index index.php index.html index.htm index.nginx-debian.html;
server_name stream.example.com;
include snippets/phpmyadmin.conf;
location / {
try_files $uri $uri/ =404 /rest/index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
phpMyAdmin location that I have included it in my server block
location /phpmyadmin {
root /storage/html/stream/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /storage/html/stream/;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~ ^/phpmyadmin/(doc|sql|setup)/ {
deny all;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /storage/html/stream/;
}
}
And this is my index.php file
<?php
print_r($_GET);
require_once("app/config.php");
require_once("app/core/core.php");
require_once( "app/core/router.php");
This is the output for http://stream.example.com/rest/?path=video/server
Array
(
[path] => video/server
)
{"authorization":0,"error":1,"result":0,"message":"Token is invalid."}
And this is the output for http://stream.example.com/rest/video/server
Array ( )
but they both should give me this output:
Array ( [path] => video/server/ )
can anyone help me with this problem ?