I am trying to send all the requests to my web server to a .cgi script without it appearing in the url (The cgi script is running Python Flask)
For example, if you go to this url:
https://example.com/page/page2
It would send the request to main.cgi with the path /page/page2, however /main.cgi wouldn't appear in the url. Also, I would like it so the user can not access any of the static files by going to their url.
So far, I have tried the following .htaccess files:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /main.cgi/$1 [L]
Sadly, this allows the user to access static files by going to their url. For example, the url example.com/static/image.jpg would return the image, not whatever is returned from the cgi script.
I have also tried:
RewriteCond %{REQUEST_URI} !=/main.cgi
RewriteRule .*/main.cgi
However, this removes the url path. For example, this url: example.com/hello would just be redirected to example.com.
How can I make the htaccess send requests to a cgi script without it appearing in the url?