简体   繁体   English

使用不同的端口从子文件夹重定向到主域

[英]Redirect from subfolder to main domain with different port

For christmas i got a raspberry pi and i want it to use it among other things as a ip cam. 圣诞节,我得到了一个树莓派,我希望它可以将它用作网络摄像机。 So i googled how to use a webcam and found a tutorial how to use motion. 因此,我用谷歌搜索了如何使用网络摄像头,并找到了如何使用运动的教程。 Worked all fine. 一切正常。

Now i have the follwing "problem": 现在,我遇到了以下“问题”:

I can access the webcam via <domain>:1337 . 我可以通过<domain>:1337访问网络摄像头。 But i want to access the webcam via <domain>/webcam . 但是我想通过<domain>/webcam访问网络<domain>/webcam

I googled some stuff about htaccess but i couldn't solve the problem since i'm fairly new to the htacces stuff. 我在htaccess上搜索了一些东西,但是由于我对htacces东西还很陌生,所以我无法解决问题。

I actived htaccess in /etc/apache2/sites-enabled/000-default and created a . 我在/etc/apache2/sites-enabled/000-default激活htaccess并创建了一个。 htaccess file in /var/www/ . htaccess文件位于/var/www/

Any idea what to write to the htacces file or how to tell motion to be available in the subfolder? 任何想法写到htacces文件或如何告诉运动在子文件夹中可用吗?

Thank you in advance! 先感谢您!

Put this code in your htaccess 将此代码放在您的htaccess中

RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteRule ^webcam$ http://<domain>.com:1337/ [P]

Note: make sure mod_rewrite and mod_proxy are enabled 注意:确保启用了mod_rewritemod_proxy

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM