How to Set Absolute Addresses for Some Links on a Website?

17 Nov,2025kjhkhlk0
How to Set Absolute Addresses for Some Links on a Website?
An absolute address refers to a complete URL that includes the domain name. Some website programs or hosting environments make it inconvenient to set up 301 redirects. To establish the preferred domain, you can set some links on the website, such as the main navigation or important links, with absolute addresses. This can also serve the purpose of determining the preferred domain.
How to Set Absolute Addresses for Some Links on a Website?
Right - click on the website homepage to view the source code or open the source code of the website program's homepage.
Look for the links pointing to the website homepage. Generally, there are two common cases:
<ahref="/">Homepage</a>
<ahref="http://www.abcdlink.com/">Homepage</a> (taking mrshair as an example)
The former is a relative address, and the latter is an absolute address. When you want to change the relative address of the homepage link to an absolute address, the operation method is: change <ahref="/"> to <ahref="http://www.abcdlink.com/">.
Similarly, modify other links:
Change <ahref="/bbs/"> to <ahref="https://www.abcdlink.com/">;
Change <ahref="/1_13.html"> to <ahref="http://www.abcdlink.cn/1_13.html">.
Often, you may not see code like href="/1_13.html" in the source code. Instead, there is a function used to call up this code. You can:
  1. Directly add http://www.abcdlink.cnin front of that function.
  2. Or delete the function and directly write the absolute address. (The consequence is that manual modifications are required when the content changes.)
For example:
Originally: <li><a: url("/{formaturl type=")article" siteurl=$siteurl name="contact"}">Contact Us</a></li>;
You can try two methods:
  1. <li><a: url("/{formaturl type=")article" siteurl=http://www.abcdlink.com/"contact"}">Contact Us</a></li>; where xxx.html is the current URL address of the "Contact Us" page.
  2. <li><a: url("/{formaturl type=")article" siteurl=http://www.abcdlink.com/$siteurlname="contact"}">Contact Us</a></li>;
Note: Make a backup before performing the operation to prevent any mistakes.
If it is not possible to use absolute addresses for all links, use absolute addresses for the main navigation, columns, headers, and footers of the website, and handle other links flexibly.
Related Questions:
  1. What are the benefits of using absolute addresses? What is the relationship with SEO?
    ① If a website is set up with absolute addresses, when different domains are simultaneously resolving to one website, all these domains will access the same content, making it difficult for search engines to determine which one is the main domain.
    ② If a website does not set absolute addresses, it may lead to competitors maliciously mirroring your website. Search engines may mistakenly index the second - level or third - level domains provided by the virtual host instead of the main domain.
    ③ Using absolute addresses on the homepage can solve the problem of the preferred domain.
  2. Do you need to change relative addresses to absolute addresses?
    It is recommended that newly - operated websites try to do this as much as possible to avoid various problems in the future. If it is too troublesome to make the changes, it is not necessary to use absolute addresses for all links. Using absolute addresses for some links on the homepage is also acceptable. For example, for websites using forum programs, only the footer in the lower - right corner needs to use absolute addresses.
  3. Briefly describe the concepts of relative addresses and absolute addresses.
    For example: Where are you now? You will definitely answer: In the United States. If a Russian asks you, you should answer: In New York, the United States.
The former is a relative address because both you and the other person are in China, so it is omitted.
The latter is an absolute address. Saying "China, the United States," everyone on Earth knows where you are.
Using absolute addresses on a website is to clearly tell search engines which is the main domain of the website.
  1. What if you don't know which page to modify when operating an open - source program?
    For open - source programs such as Discuz and Shopex, the programs are relatively complex. You can first try to solve the problem with 301 redirects. If 301 redirects can be achieved, try not to modify the program as much as possible. If 301 redirects cannot be achieved, use absolute addresses for the main navigation and footer links on the website. The links of sections, categories, and inner pages do not need to be modified.
【版权与免责声明】如发现内容存在版权问题,烦请提供相关信息发邮件至 ,我们将及时沟通进行删除处理。 本站内容除了谷歌外链,友情链接https://www.abcdlink.com )特别标记的原创外,其它均为网友转载内容,涉及言论、版权与本站无关。