2012-01-04 33 views
0

我使用的httpd.conf与mod_rewrite的除去从网页文件扩展名....的httpd.conf命令为.htaccess

我在httpd.conf使用的代码是

<IfModule mod_rewrite.c> 
     Options +FollowSymLinks 
     Options +Indexes 
     RewriteEngine On 
     RewriteCond %{SCRIPT_FILENAME} !-d 
     RewriteRule ^([^\.]+)$ $1.html [NC,L] 
    </IfModule> 

这并不使用.htaccess文件在我的外部服务器上工作,并且我无法访问httpd.conf文件....

任何想法如何更改命令,以便我可以删除所有.html .htaccess改为........

在此先感谢:d

+0

没有你确定它不工作测试哪些网址,以及结果是什么? – 2012-01-05 23:26:58

+0

如果该代码是在.htaccess文件,它只是加载错误页面,404 .... 我知道,htaccess和httpd.conf的代码是不同的,并试图逐行删除,我认为问题是RewriteRule ....线 – 2012-01-05 23:56:03

+0

和我测试了几乎所有的网站,我的网站有和没有页面扩展名....没有欢乐 – 2012-01-05 23:56:32

回答

0

请尝试以下的.htaccess文件

Options +FollowSymLinks 
Options +Indexes 
RewriteEngine On 
RewriteBase/

#if an html version of this file exists 
RewriteCond %{REQUEST_FILENAME}\.html -f [NC] 
#then server it 
RewriteRule . %{REQUEST_FILENAME}.html [NC,L] 
+0

谢谢你现在试试看:D – 2012-01-06 00:31:36

+0

OMG非常感谢它的工作.....我可以拥抱你..... – 2012-01-06 00:33:46