我在网站上使用nanoCMS (来自mini-print.com)。和他们提供的htaccess文件。
目录结构是-
cms/
error404.php
htaccess-laplume.txt
htaccess.txt
img/
readme.txt进入localhost/时,我得到的是文件列表,而不是重定向到/cms/index.php
我搞不懂这个!有没有人能给我提点建议呢?
(这里是htaccess文件)
# Edit and save this file as .htaccess before uploading
AddDefaultCharset UTF-8
Options +FollowSymLinks -Indexes
RewriteEngine On
DirectoryIndex index.php
ErrorDocument 404 /error404.php
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^$ /cms/index.php [L]
RewriteCond %{REQUEST_URI} ^/cms/inc/menu\.php$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/inc/inmenu\.txt$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/admin/list\.php$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/([A-Za-z0-9_-]+)\.txt$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/comments/([A-Za-z0-9_-]+)\.txt$ [OR]
RewriteCond %{REQUEST_URI} ^/img/$
RewriteRule .* - [F]
RewriteCond %{REQUEST_URI} ^/cms/$
RewriteRule ^cms/$ / [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /cms/([A-Za-z0-9_-]+)\.php\ HTTP/
RewriteRule ^cms/([A-Za-z0-9_-]+)\.php$ /$1 [R=301,L]
RewriteCond %{REQUEST_URI} !^/index$
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([A-Za-z0-9_-]+)\ HTTP/
RewriteRule ^([A-Za-z0-9_-]+)$ /cms/$1.php [L]发布于 2013-08-16 09:41:58
您需要将htaccess文件移动到文档根目录,否则,访问/不会触及/cms/文件夹中的任何内容。
此外,您需要确保httpd.conf文件中的AccessFilename设置为htaccess.txt。否则,您可以将htaccess.txt重命名为访问文件名定义的任何名称。您还应该确保您正在加载重写模块,该模块也应该在您的httpd.conf文件中,并且应该如下所示:
LoadModule rewrite_module modules/mod_rewrite.so确保该行没有被注释掉。
https://stackoverflow.com/questions/18264185
复制相似问题