【发布时间】:2014-04-02 01:25:57
【问题描述】:
如何将 index/ 放入 directoryIndex?
当我访问这个 url localhost/mywebsite/ 我的网站没有正确安排 但是当我把 localhost/mywebsite/index/ 它工作正常。
这是我的 htaccess 文件
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
DirectoryIndex index.php index.php3 index.html index.htm index/ <-- i add this
提前致谢:)
附言。 localhost/mywebsite/index/ = localhost/mywebsite/index.php 我只是将我的网页的文件扩展名隐藏到/(斜线)。
【问题讨论】:
-
您的问题有误;您问题中的两个有效网址都是
localhost/mywebsite/。 -
您还可以详细说明您的实际问题,而不是“未正确安排”。
-
抱歉。 localhost/mywebsite/index/ 我的意思是这个:D