2014-02-11 92 views
1

我有一個名爲「http://www.abc.com」的網站,它有一個htaccess文件。子文件夾htacess文件不工作

而我有一個名爲「http://www.abc.com/sub/」的子文件夾,它有一個htaccess將.php轉換爲.html頁面擴展名,但它不起作用。

RewriteEngine on 
RewriteCond %{HTTP_HOST} !^www\.abc\.com 
RewriteRule (.*) http://www.abc.com/$1 [R=301,L] 
RewriteRule ^(.*)\.html $1\.php 

我能爲此做些什麼?

回答

0

也許你應該使用RewriteBase指令。

首先確保mod_rewrite模塊已從您的httpd.conf文件中激活。

LoadModule rewrite_module modules/mod_rewrite.so 

然後把下面.htaccess文件到文件夾sub/

RewriteEngine on 
RewriteBase /sub/ 
RewriteRule ^(.*)\.html$ $1.php