我有一个静态网站,里面有几页,并安装了Wordpress。我将wordpress上传到服务器,我可以使用链接href="blog''"从任何静态页面访问它。静态 html 页面存储在服务器的主目录中,该目录也是存储博客的位置。目录如下所示:
public_html/ //Server directory
-index.html
-contact.html
-about.html
-blog/ //Folder with blog installation
--wp-content/
---themes/
----theme_name/
-----file_with_links.php
我试图将链接放在 php 文件"file_with_links.php"中,该文件将链接回静态 html 页面,这些页面距离它有几个目录。我试图使用../../../../../页.html没有运气。有没有简单的方法可以做到这一点?任何帮助将不胜感激。
-谢谢
最佳做法是使用完整的 URI ( http://YourSiteHere.com/YourFileHere.html
)。
为此,请在file_with_links.php
文件中使用以下代码:
$root_toot = "http://YourSiteHere.com";
$to_contact = '<a href="' . $root_toot . '/contact.html">Contact</a>';
$to_about = '<a href="' . $root_toot . '/about.html">About</a>';
等。