Why are my CP links navigating to the .../optimized/.../themes/ directory instead of where I point them?
Environment:
Customer Portal (CP)
Resolution:
Sometimes links in CP will resolve to something like this:
https://site.custhelp.com/euf/rightnow/optimized/1414097899/themes/standard/app/some/page
When they should send the user to a page like this:
https://site.custhelp.com/app/some/page
The .../optimized/.../themes/... path is being used because the link is using a relative path rather than an absolute one. Looking at your page source code, a link that looks like this will break in this way:
href="app/some/page"
Changing relative links to absolute links in your page's source code will fix the problem. For the example above, this would be the corrected href link in the source code:
href="https://site.custhelp.com/app/some/page"
Cause:
In CP, this tag shows up inside the <head> tags on the page:
<base href='http://site.custhelp.com/euf/rightnow/optimized/1416115321/themes/standard/'></base>
This sets the base URL that all relative links are, well, relative to, so any link will follow the base href value. This is how all the CSS and other assets like that on the page get loaded from the correct environment when you view a page in development/staging/production.