mod_rewrite没有创建子文件夹

时间:2015-03-09 10:36:50

标签: .htaccess mod-rewrite apache2

我试图让我的重写规则正常工作,以便/stream/file.mp4重定向到/stream.php?f=file.mp4。 但是,这仅在我创建名为stream的文件夹时有效。我做错了什么?

RewriteEngine on 
RewriteBase /
RewriteRule ^stream/(.*)$ /stream.php?f=$1
RewriteRule ^(.*)\.html$ $1.php

1 个答案:

答案 0 :(得分:1)

在root .htaccess中尝试此代码并禁用MultiViews

Options -MultiViews
RewriteEngine on 
RewriteBase /

RewriteRule ^stream/(.+)$ stream.php?f=$1 [L,QSA,NC]

RewriteRule ^(.+?)\.html$ $1.php [L,NC]