2013-03-08 39 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

相關問題