2013-03-08 82 views
0

我在Linux OS CENT 6.3最新的PHP和最新版的Apache,example.com/dir/index.php作品,但example.com/dir/不

在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中工作,但不在此配置中工作。

+0

如果你添加一个index.html到目录,那么/ mydir/work呢?不确定关于Linux,但在Windows中,您必须设置默认文档。 – 2013-03-08 02:27:54

+0

是的,它不适用于index.html – lbennet 2013-03-08 02:33:03

+0

是的,这绝对是我将修复它的htaccess文件,但它在另一个服务器配置上运行良好。 – lbennet 2013-03-08 02:46:23

回答

0

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

检查你的DirectoryIndex指令设置。它应该有至少index.php来支持你的需求:

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

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

+0

但是,如果我去除.htaccess内容并上传它的作品。它是httpd.conf中的'DirectoryIndex index.php' – lbennet 2013-03-08 02:40:54

+0

发生问题的最大机会是在'master/index.php'行,但你不在该目录中。 – Raptor 2013-03-08 02:51:00

相关问题