从mod_rewrite中排除链接

时间:2012-10-06 07:18:05

标签: .htaccess

你好这是我的htaccess代码

Options All -Indexes
ErrorDocument 404 /404.php
FileETag MTime Size

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /lang/

RewriteRule ^sitemap\.xml$ index.php [L]
RewriteRule ^(.*)(\.html|\.htm)$ index.php [L]
RewriteRule ^(.*)(\.rss|\.atom|\.txt)$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/?$ index.php [L]
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresByType image/gif "access plus 1 months"
    ExpiresByType image/jpeg "access plus 1 months"
    ExpiresByType image/png "access plus 1 months"
    ExpiresByType text/css "access plus 1 months"
    ExpiresByType application/x-javascript "access plus 1 months"
</IfModule>

我有这个联系表格

http://www.example.com/lang/contact-se

当用户使用表单并联系

重定向到

http://www.example.com/lang/contact-se.html

并给我找不到错误页面

如何仅从重写和重定向到.html

中排除此链接

1 个答案:

答案 0 :(得分:0)

更改您的表单以提交至/lang/contact-se而不是/lang/contact-se.html

不确定这与您的规则有什么关系,contact-se和contact-se.html都指向index.php