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