我正在使用以下代码隐藏我的.htaccess文件中的.php扩展名.....
<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>
然而,我的Captcha停止了工作。图像由以下代码行调用...
<img src="assets/phpscripts/captcha_code_file.php?rand=<?php echo rand(); ?>
我尝试从图片链接中移除.php但仍然没有快乐。关于如何对此进行排序的任何想法?
答案 0 :(得分:1)
所以答案是在htaccess中为captcha url添加规则。
RewriteRule ^/?assets/phpscripts/captcha_code_file.php$ - [L]