Mod_rewrite导致联系表单无效

时间:2010-12-10 01:26:08

标签: mod-rewrite url-rewriting file-extension

我有一个网站,其联系人曾经工作正常。

我已将其缩小到导致表单不起作用的mod_rewrite规则。

# If client requested does not exist as a directory or a file
# then add .php to the actual filename
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]

# Gets rid of the file extensions in the address bar
# If client request header contains php file extension
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.php\ HTTP
# externally redirect to extensionless URI
RewriteRule ^([^.]+)\.php$ http://cacrochester.com/$1 [R=301,L]

如何对其进行修改,使其不会影响页面http://cacrochester/Contact-Us.php上的联系表单,但仍会删除地址栏中的扩展程序?

1 个答案:

答案 0 :(得分:0)

使该表单指向不带 .php 的网址。

指向http://www.cacrochester.com/Contact-Us而不是http://www.cacrochester.com/Contact-Us.php