微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

.htaccess:如何保持相同的URL,但在服务器上显示不同的页面

我怎样才能保持相同的URL,但使用.htaccess重写规则在服务器上显示不同的页面? 我正在研究热链接保护。 播放列表是使用以下链接生成的: http://site.com/get.playlist.PHP? : http://site.com/get.playlist.PHP?

完整的链接

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

我想redirect链接

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

如何使用htaccessredirect所有访问者,但search引擎机器人

mod_rewrite不传递查询string

使用参数redirect到主页url

http:// domain to https:// www in one redirect

Mod_rewrite将example.com/page.PHP?v1=abc&v2=def改为example.com/abc/def

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

.htaccess – redirectfavicon

Apache – 如何在debugginghtaccess时禁用浏览器caching

我可以禁用特定目录的重写吗?

在网站根目录和子目录中使用.htaccess中的mod_rewrite

WAMP 2.4上的Mod_rewrite

那会是这样的:

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

虽然这可能会导致无效的网址,但您需要对查询字符串中的:和/等字符进行网址编码。

一个问题是重定向一个不同的域,所以URL可能会在浏览器地址栏中改变。

它是否真的在不同的领域,因为你的问题标题似乎暗示其他?

如果不是,您可以将其更改为:

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐