apache - 重定向到 rtmp 协议(protocol)时,RewriteRule 将子文件夹附加到 url

标签 apache .htaccess mod-rewrite rtmp

我正在使用 htaccess 重定向到 rtmp 流

RewriteRule ^redirect$ rtmp://url.tv/live/

htaccess 位于 /subfolder1/subfolder2/

问题在于该路径被添加到 rtmp url 之前

我收到此错误:

在此服务器上找不到请求的 URL/subfolder1/subfolder2/rtmp://url.tv/live/。

使用 http url,效果很好。 我还尝试使用 DPI 标志,但没有运气

RewriteRule ^redirect$ rtmp://url.tv/live/ [DPI]

最佳答案

将该规则替换为 RedirectMatch规则:

RedirectMatch ^/redirect/?$ rtmp://url.tv/live/

否则RewriteRule无法识别rtmp://作为一个独立的协议(protocol)并附加 http://如果使用 R 则为目标 URI旗帜。

关于apache - 重定向到 rtmp 协议(protocol)时,RewriteRule 将子文件夹附加到 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27950378/

相关文章:

apache - 仅当文件不存在时才使用代理

apache - htaccess 将 RewriteBase 设置为请求 URI 的开头

linux - 如何将各种独立域重定向到各种 wordpress 类别页面

apache - .htaccess 重写规则不会使用 unicode 字符

正则表达式 : get the two letters after the slash or after the last dot

PHP代码没有被执行,但是代码显示在浏览器源代码中

C:程序停止,没有错误

apache - 如何使用 htaccess 对所有 *.html 查询返回 410 错误?

Apache 重写 URL 但不重写某些文件夹

.htaccess - HTTP 到 HTTPS 301 重定向代码不工作,它说重定向太多