Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 如何进行实习生URL屏蔽(只保留域名)_Apache_.htaccess_Cakephp_Dns_Ubuntu 18.04 - Fatal编程技术网

Apache 如何进行实习生URL屏蔽(只保留域名)

Apache 如何进行实习生URL屏蔽(只保留域名),apache,.htaccess,cakephp,dns,ubuntu-18.04,Apache,.htaccess,Cakephp,Dns,Ubuntu 18.04,如何进行完整的URL屏蔽,例如,我的网站如下所示: 我正在使用CakePHP作为数字海洋水滴中的一个框架,使用(Apache2/Ubuntu18.04) CakePHP目录的路径:/var/www/html/websiteDir 当我访问我的网站时,框架使链接看起来是动态的,例如: 我想让用户点击链接,但只显示域名,我不想让他看到完整的网址 我正在使用.htaccess文件(路径:/var/www/html/.htaccess)从http强制https重定向 选项+FollowSymlin

如何进行完整的URL屏蔽,例如,我的网站如下所示:

我正在使用CakePHP作为数字海洋水滴中的一个框架,使用(Apache2/Ubuntu18.04)

CakePHP目录的路径:/var/www/html/websiteDir

当我访问我的网站时,框架使链接看起来是动态的,例如:

我想让用户点击链接,但只显示域名,我不想让他看到完整的网址

我正在使用.htaccess文件(路径:/var/www/html/.htaccess)从http强制https重定向


选项+FollowSymlinks
重新启动发动机
重写基/
重写cond%{HTTP_HOST}^website.com[或][NC]
重写cond%{HTTP_HOST}^www.website.com[NC]
重写规则。*websiteDir[R=301,L]

欢迎对我的.htaccess文件或我的虚拟主机文件进行任何改进,请随意

我猜您正在使用方法
$this->Html->link()
创建链接。当您提供单个参数(url)时,如:

echo$this->Html->link(['controller'=>'controller','action'=>'view']);
//结果:
// 
使用两个参数,第一个是要显示的文本,第二个是url,这将导致:

echo $this->Html->link(
    Router::url('/', true),
    ['controller' => 'Controller', 'action' => 'view']
);

// Result:
// <a href="https://website.com/Controller/View">
//     https://website.com/
// </a>
echo$this->Html->link(
路由器::url(“/”,true),
['controller'=>'controller','action'=>'view']
);
//结果:
// 

用户将只看到域。路由器可通过
使用Cake\Routing\Router

使用。您不希望他们在页面内容或地址栏中看到URL吗?
echo $this->Html->link(['controller' => 'Controller', 'action' => 'view']);

// Result:
// <a href="https://website.com/Controller/View">
//     https://website.com/Controller/View
// </a>
echo $this->Html->link(
    Router::url('/', true),
    ['controller' => 'Controller', 'action' => 'view']
);

// Result:
// <a href="https://website.com/Controller/View">
//     https://website.com/
// </a>