htaccess的:我怎样才能保持相同的URL,但在服务器上显示一个不同的页面但在、器上、不同、页面

2023-09-02 01:15:45 作者:天生暴脾气

我怎么能保持相同的URL,但会显示使用的.htaccess重写规则的服务器上的不同页面? 我工作的防盗链。播放列表与下面的链接生成的: http://site.com/get.playlist.php

中的完整链接:

http://site-1.com/get.playlist.php?playlist=http://site.com/video/34141ce7760f58f0c3eb5e0c758afb69/pl/playlist.txt&hash=34141ce7760f58f0c3eb5e0c758afb69

我想从

重定向链接

  http://site-2.com/video/34141ce7760f58f0c3eb5e0c758afb69/pl/playlist.txt
 

http://site-1.com/get.playlist.php?playlist=http://site.com/video/34141ce7760f58f0c3eb5e0c758afb69/pl/playlist.txt&hash=34141ce7760f58f0c3eb5e0c758afb69 SSH不显示htaccess文件的解决办法

解决方案

这会是这样的:

 重写规则^视频/( w +)/( w +)/( w +)$ http://site-1.com/get.playlist.php?playlist=http ://site.com/video/$1/$2/$3&哈希= $ 1
 

尽管这可能会导致一个无效的网址,你需要给url EN $ C C字符$如 / 的查询字符串。

这是另一个问题是,重定向是不同的域,所以链接将在浏览器的地址栏可能发生变化。

难道真的在不同的领域,因为你的问题的标题似乎暗示,否则?

如果没有,你可以将其更改为:

 重写规则^视频/( w +)/( w +)/( w +)$ /get.playlist.php?playlist=http://site.com/video/ $ 1 / $ 2 / $ 3和散列= $ 1
 

How can I keep the same the URL, but display a different page on the server using .htaccess rewrite rule? I'm working on hotlink protection. The playlist is generated with the following link: http://site.com/get.playlist.php?

the full link:

http://site-1.com/get.playlist.php?playlist=http://site.com/video/34141ce7760f58f0c3eb5e0c758afb69/pl/playlist.txt&hash=34141ce7760f58f0c3eb5e0c758afb69

i would like to redirect the link from

http://site-2.com/video/34141ce7760f58f0c3eb5e0c758afb69/pl/playlist.txt

to

http://site-1.com/get.playlist.php?playlist=http://site.com/video/34141ce7760f58f0c3eb5e0c758afb69/pl/playlist.txt&hash=34141ce7760f58f0c3eb5e0c758afb69

解决方案

That would be something like:

 RewriteRule ^video/(w+)/(w+)/(w+)$ http://site-1.com/get.playlist.php?playlist=http://site.com/video/$1/$2/$3&hash=$1

Although that would probably result in an invalid url, you would need to url encode the characters like : and / in the query string.

An additional problem is that the redirect is to a different domain, so the url would probably change in the browser address bar.

Is it really on a different domain, as your question title seems to imply otherwise?

If not, you can change it to:

 RewriteRule ^video/(w+)/(w+)/(w+)$ /get.playlist.php?playlist=http://site.com/video/$1/$2/$3&hash=$1