example.com/dir/index.php有效,但example.com/dir/没有

时间:2013-03-08 02:25:03

标签: apache httpd.conf

我在Linux CENT OS 6.3上使用最新的php和最新的apache,

在httpd.conf上我得到了

DirectoryIndex index.php

<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

当我去:

example.com/mydir/index.php 

它可以工作,但它不适用于example.com/mydir /

这对我来说是一个问题。

实际上它可能与.htaccess文件中的某些内容有关:

RewriteEngine on
options +FollowSymLinks

RewriteRule    ^([A-Za-z-0-9-_.]+)/pics/([A-Za-z-0-9-_.]*.*)?$ users/$1/pics/$2
#levanta de users/pics

RewriteRule    ^([A-Za-z-0-9-_.]+)/vids/([A-Za-z-0-9-_.]*.*)?$ users/$1/vids/$2
#levanta de users/vids

RewriteCond    %{REQUEST_URI} ^.*\.(html|png|jpg|gif|jpeg|css|js)
RewriteRule ^([^/]+)(/(.*))?$ - [L]


RewriteCond    %{REQUEST_URI} !settingsd
RewriteRule ^settings settingsd/settings.php

RewriteRule ^lists/ master/index.php
RewriteRule ^lists/(.*)$ $1


RewriteRule ^index\.(php) master/index.php
#levanta de master/


RewriteCond    %{REQUEST_URI} !.*\.(css|js|php)|pokes|settings|subgram
RewriteRule   ^([A-Za-z-0-9-_.]+)?$ master/$2

RewriteCond    %{REQUEST_URI} !pokesd
RewriteRule ^pokes(.*)$ pokesd/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond    %{REQUEST_URI} !pokes|subgram
RewriteRule    ^([A-Za-z-0-9-_.]+)/([A-Za-z-0-9-_.]+.php)?$    master/$2
#levanta de master/


RewriteRule   ^messages/ messages.php

RewriteRule    ^notes/me/ notes/notes.php 
RewriteRule    ^notes/drafts/ notes/notes_drafts.php
RewriteRule    ^notes/tagged/ notes/notes_tagged.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !photos_albums|photos_stream
RewriteRule ^([A-Za-z-0-9-_.]+)/photos $1/view_photos.php
RewriteRule ^([A-Za-z-0-9-_.]+)/photos_albums $1/view_photos.php?sk=photos_albums
RewriteRule ^([A-Za-z-0-9-_.]+)/photos_stream $1/view_photos.php?sk=photos_stream

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([A-Za-z-0-9-_.]+)/friends $1/view_friends.php


RewriteCond    %{REQUEST_URI} !listsd
RewriteRule ^bookmarks/lists(.*)$ bookmarks/listsd/$1

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^v(.*)$ v/video_embed.php?sbid=$1

RewriteCond    %{REQUEST_URI} !.*\.(css|js|php)|notes/me/|notes/drafts/|notes/tagged/
RewriteRule    ^notes/ notes/



RewriteRule ^r.php$ gvrrgvrr45.php$1

它与那里的规则有关,因为当我将其全部剥离并上传到服务器时它会突然运行,同样.htaccess在Windows中工作但在此配置中不起作用。

1 个答案:

答案 0 :(得分:0)

它与.htaccess无关。这是你的Apache设置(/etc/httpd.conf

检查DirectoryIndex指令设置。它至少应该index.php来满足您的需求:

DirectoryIndex index.html index.htm index.shtm index.shtml index.php  

或删除任何不符合您需求的条目。