我试图获得请求的文件名,而没有路径 htaccess的RewriteCond。 REQUEST_FILENAME
返回完整的绝对路径,但我只需要像test.php的文件名htaccess获取文件名无路径
我一直在寻找这个有很多,但无法找到任何东西,帮我摆脱困境。 感谢您提前做出任何回应!
编辑:
我试着做这样的事情:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond _%{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]*)$ _$1.php [L]
- 在浏览器中键入的URL看起来是这样的:http://example.org/test
- 将由被requestested文件重写规则是:http://example.org/_test.php
- With
RewriteCond _%{REQUEST_FILENAME}.php -f
i试图检查文件是否存在第一
基本上我想这样做:
URI:/测试/等等
检查_ test.php的存在(有下划线!)
看看这个问题:http://stackoverflow.com/questions/470880/rewriterule-checking-file-in-rewriten-file-path-exists – Christopher