我使用下面的代码隐藏我的。php扩展在我的。htaccess文件.....
<IfModule mod_rewrite.c>
RewriteEngine On
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://example.com/folder/$1 [R=301,L]
# Redirect external .php requests to extensionless url
RewriteCond %{THE_REQUEST} ^(.+)'.php([#?][^' ]*)?' HTTP/
RewriteRule ^(.+)'.php$ http://example.com/folder/$1 [R=301,L]
# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
</IfModule>
然而,我的验证码停止工作。下面的代码行正在调用图像…
<img src="assets/phpscripts/captcha_code_file.php?rand=<?php echo rand(); ?>
我试着从图像链接中删除。php,但仍然没有乐趣。知道怎么排序吗?
所以答案是在htaccess中添加一个规则,用于captcha url。
RewriteRule ^/?assets/phpscripts/captcha_code_file.php$ - [L]