HTML anchors are not working, missing images or other resources
- Last revised:
- Pátek, 19 Červen 2009
Answer
Please note, that if base href generation is used, then all relative anchors, such as just "#anchor", or all other resources using relative paths (such as "/images/myimg.png" or "myfiles/file1.pdf") are automatically translated with the base href URL.
This means, that if you are using anchors and homepage as base href, all anchors will be looked at within the homepage, not the actual SEF URL! Using the same logics, if using actual SEF URL as base href and having "/images" as relative path, this path will be understood by browser as it would be appended behind the SEF URL! This is the most often reason why anchors do not work or some resources (such as images or styles) appear to be missing in the page when SEO and generation of SEF URLs that adds virtual directory structure in the URL addresses is ON.
To solve this, you have to either:
- disable generation of base href tag or
- keep the base href tag generation on, but make sure all links using SEO URLs + anchors or poiting to resources are absolute, not relative