在你对应的目录下面做一个.htaccess文件RewriteEngine On
RewriteBase /自己的base目录/# Rewrite www.domain.com to domain.com
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^(.*) http://%1/$1 [R,L]#uploaded files
RewriteRule ^(.*)?/?files/(.*) wp-content/blogs.php?file=$2 [L]RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]RewriteRule . index.php [L]
RewriteBase /自己的base目录/# Rewrite www.domain.com to domain.com
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule ^(.*) http://%1/$1 [R,L]#uploaded files
RewriteRule ^(.*)?/?files/(.*) wp-content/blogs.php?file=$2 [L]RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]RewriteRule . index.php [L]
你可以在Apache的配置文件httpd.conf里修改文件名,找到AccessFileName .htaccess修改一下文件名格式,比如改成#AccessFileName a.htaccess,然后你就可以在你网站根目录新建这个a.htaccess在里面写规则了。
httpd.conf对以下代码进行了修改:
<Directory "F:/www/test">
Options Indexes FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
而a.htaccess文件中的应该不会有错误,因为这是我设置(修改)httpd.conf的方法测试成功的语句。
因此问题应该在要让他解析a.htaccess文件应该怎样设置httpd.conf?