htaccess rewriterule problem -- index.php/ not working
Describe the bug
The following rewriterule in the htaccess file in the api directory is not working:
RewriteRule ^(.*)$ %{ENV:BASE}index.php/ [QSA,L]
Instead of forwarding requests to './api/index.php/, it routes all requests back to the web root /`. No requests to the api directory will work (e.g. authenticate, login).
Expected behavior It should forward correctly.
Removing the slash from the rewrite rule appears to fix the problem
RewriteRule ^(.*)$ %{ENV:BASE}index.php [QSA,L]
Calls to api now trigger an appropriate JSON formatted response.
I'm not expecting anyone to be able to fix anything serverside that is preventing this rewriterule from working, but I'm wonderinf if the slash is really necessary? Why not use skip the slash? Reading the Slim documentation, they do not include a slash in their suggested rewrite rules.
Additional context
AllowOverride All is enabled
Apache version
[~]$ /usr/sbin/apache2 -v
Server version: Apache/2.4.29 (Ubuntu)
Server built: 2020-08-12T21:33:25
Server API: CGI/FastCGI
Apache modules
[~]$ /usr/sbin/apache2ctl -M
[Thu Nov 26 20:05:18.434825 2020] [so:warn] [pid 5511] AH01574: module dav_module is already loaded, skipping
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
dav_module (shared)
dav_svn_module (shared)
authz_svn_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
fcgid_module (shared)
filter_module (shared)
mime_module (shared)
mpm_event_module (shared)
negotiation_module (shared)
passenger_module (shared)
qos_module (shared)
reqtimeout_module (shared)
security2_module (shared)
setenvif_module (shared)
status_module (shared)
unique_id_module (shared)
xsendfile_module (shared)
I'll look into this. Seems like it's probably an error on my part.
I ended up with
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteRule ^taskboard.sqlite$ %{ENV_BASE}index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ %{ENV:BASE}index.php?/$1 [QSA,L]
php_value upload_max_filesize 80M
php_value post_max_size 100M
php_value file_uploads On
php_value memory_limit 256M
based on https://stackoverflow.com/questions/14555996/no-input-file-specified
It allows me to log in, but then I'm immediately logged out.