I'm trying to get the requested filename without the path with htaccess for a RewriteCond.
REQUEST_FILENAME
returns the full absolute path, but I only need the filename like test.php
I've been searching for this a lot but couldn't find anything that helped me out. Thanks for any responses in advance!
Edit:
Im trying to do something like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond _%{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]*)$ _$1.php [L]
- The URL typed in the browser looks like this: http://example.org/test
- The File that will be requestested by the RewriteRule is: http://example.org/_test.php
- With
RewriteCond _%{REQUEST_FILENAME}.php -f
i tried to check if the file exists first
Basically I want to do this:
URI: /test/blah
Check if _test.php exists (with underscore!)