如何处理mod-rewrite与自定义URL方案? [英] How to handle mod-rewrite with a custom url scheme?

查看:110
本文介绍了如何处理mod-rewrite与自定义URL方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此​​,这里是我的问题:我试图做一个重定向在与htaccess文件的网页。这种重定向将是朝着一个自定义URL(即不是IKE的http:// ...,但像myurl:// ...)。

So here's my problem : I'm trying to do a redirection on a webpage with the htaccess file. This redirection will be towards a custom URL (i.e not something ike "http://..." but something like "myurl://...).

现在,我是一个小地方的Apache服务器,在此我有一个index.html页面,一个测试目录,此目录中.htaccess文件和一个test.html的文件上尝试这个。

For now, I'm trying this on a little local apache server, in which I have a index.html page, a "test" directory and in this directory a .htaccess file and a test.html file.

下面是什么.htaccess文件里面:

Here's what's inside the .htaccess file :

Options +FollowSymLinks
RewriteEngine   On
RewriteBase /
RewriteRule     ^(.*)$ myurl://test$1 [R=302]

我想问题可能来自于这里,因为我完全在这个新的,这是我第一次尝试写到.htaccess文件。所以,如果这不是正确的方式做到这一点,什么是正确的方式做到这一点呢?

I think the problem probably comes from here, as I'm totally new at this and this is the first time I try to write into a .htaccess file. So, if this is not the proper way to do this, what is the proper way to do this then ?

由于任何人谁可以帮助

推荐答案

也许我失去了一些东西,但URL的preFIX是协议。客户端浏览到该URL已绑定该协议的应用程序。 HTTP(S)=浏览器,磁= BT客户端,MAILTO =电子邮件客户端等。

Perhaps I'm missing something but the prefix of the URL is the protocol. The client browsing to the url has an application bound to this protocol. HTTP(S) = Browser, MAGNET = torrent client, MAILTO = Email client, etc..

因此​​,如果您的客户端配置为实际使用的那种网址,你会联系您无论是在HTTP或HTTPS ..服务器,所以我猜你不能检查协议..?

So if your client is configured to actually use that kind of url you will contact your server either in http or https.. so I'm guessing you can't check on protocol.. ?

如果Apache是​​接受你的请求,我想你可以使用%检查整个网址{} SCRIPT_URI

If apache is accepting your request I guess you can check the entire url using %{SCRIPT_URI}.

这篇关于如何处理mod-rewrite与自定义URL方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆