[英]hide the URL path of the download file using .htaccess file
我花了一整天的时间试图让这个 URL 从地址栏或 PDF 文档中隐藏起来。
在堆栈溢出中,有大量的样本,但我没有让它们中的任何一个启动并运行。
而不是在文件中显示:
https://msia.com/wp-content/themes/astra-child/pdf.php?key=1547
我只需要显示这个
https://msia.com/
代码
$order_url = "https://msia.com/wp-content/themes/astra-child/pdf.php?key=";
$url = '<a href="'.$order_url.$order_id.'"><b>Download PDF</b></a>';
$order_id = receives the dynamic id. Eg: 1547
这是我尝试过的:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ([^/]+)\.example\.com.*
RewriteCond %{REQUEST_URI} ^/([^/]+)$
RewriteRule .* http://%1.msia.com/somepath/%1/%2 [L]
RewriteRule ^https://msia.com https://msia.com/wp-content/themes/astra-child/pdf.php [NC,L]
# sends all requests from “/” to “/Site/am/index.php”
RewriteRule ^https://msia.com/wp-content/themes/astra-child/pdf.php$ https://msia.com
有了这个例子,我丢失了完整的CSS形成的链接——PDF文件不是浏览器来渲染JS。
<a href="http://www.google.com" id="no-link">Hyperlink</a>
$(document).ready(function () {
setTimeout(function () {
$('a[href]#no-link').each(function () {
var href = this.href;
$(this).removeAttr('href').css('cursor', 'pointer').click(function () {
if (href.toLowerCase().indexOf("#") >= 0) {
} else {
window.open(href, '_blank');
}
});
});
}, 500);
});
如果我正确理解您的问题,您希望工具提示显示除完整 URL 以外的其他内容?
查看您的代码,您似乎正在从 HTML 生成 PDF 的布局并将其提供给生成器。
PDF 生成器往往没有完整的 HTML 支持,但您可以尝试将title="Something that will appear in the tooltip"
属性添加到您的<a>
标记。
像这样的东西:
<a href="'.$order_url.$order_id.'" title="Something that displayed in the tooltip"><b>Download PDF</b></a>
这可以工作,但它确实取决于生成器及其对这个属性的支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.