[英].htaccess redirect url.com/file.php?=$terms to newurl.com/search.php?=$terms if referrer is not site.com
I have 2 video sites, one of them is a video host ( url.com
) and another is a wordpress frontend ( newurl.com
) where I embed videos from my video host. 我有2个视频站点,其中一个是视频主机(
url.com
),另一个是wordpress前端( newurl.com
),我在其中嵌入了视频主机中的视频。
What I want to do is disable any access to the content of the video host except my main site being able to still embed files. 我想要做的是禁用对视频主机内容的任何访问,但我的主站点仍然能够嵌入文件。
I thought of doing it via using htaccess and using rule to allow access only if reffer is newurl.com else if there is no referrer or something else. 我想通过使用htaccess和使用rule来做到这一点,只有在reffer为newurl.com时才允许访问,否则,如果没有引荐来源网址或其他内容,则允许访问。
But problem is the video embed shows related videos within the video player of the embed and thats from where the users get link to the video host. 但是问题在于视频嵌入会在嵌入的视频播放器中显示相关视频,并且多数民众赞成从中获得与视频主机的链接。
I want to do something like this. 我想做这样的事情。
When a user clicks a related video, he is redirected to something like this: 当用户点击相关视频时,他将被重定向到以下内容:
url.com/player/cbplayer/plugins/related/related_videos.php?vid=%%VID ID%%&title=%%VIDEO TITLE%%&tags=%%VIDEO TAGS%%
I want to redirect him to my main site like this 我想像这样将他重定向到我的主站点
newurl.com/search.php?=%%VIDEOTITLE
or if Video title cant be used then atleast the whole string after related_videos.php
itself 或者如果无法使用视频标题,则在
related_videos.php
本身之后至少保留整个字符串
Basically I want to redirect my users from videohost url to a search form on my main site itself. 基本上,我想将用户从videohost网址重定向到主站点本身上的搜索表单。
Also, while using Referrers I want to be safe that it doesnt redirects the embed from my main site content as well 另外,在使用引荐来源网址时,我想确保它不会从我的主要网站内容中重定向嵌入内容
The embed file is called embed.php
嵌入文件称为
embed.php
If I am understanding you correctly, this will match all hits on related_videos.php
(with a title querystring) but only when referrer is not your.domain
and redirect them to thatnewurl.com/search.php?title=oldtitle
如果我理解正确你,这将匹配所有命中
related_videos.php
(带有标题查询字符串),但只有当引用不your.domain
并重定向他们thatnewurl.com/search.php?title=oldtitle
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !your\.domain
RewriteCond %{QUERY_STRING} (^|&)title=(.*?)(&|$) [NC]
RewriteRule related_videos\.php http://thatnewurl.com/search.php?title=%2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.