Question

Is it a bad practice to use relative urls with explicit base for dynamic site?

For example, like this one:

<base href="http://my-site.com/mount-point-of-site">
...
<img src='/my-page/my-image.jpg'></img>

I need it because mount point of site can be changed over time, and I need to preserve referential integrity of wiki-like content produced by users (links to relative pages, relative image paths, ...).

But I never saw such technique in use for dynamic web applications, usually it's handled on the server-side.

Is there any specific disadvantages of such technique, that may bite me later? SEO, cross-browser / mobile compatibility, some other aspects?

Was it helpful?

Solution

I get what you're saying about applications not using absolute urls. You'll typically set the base url in a config file, not as a meta tag in that instance.

Best practice? Always use absolute urls incase anyone links to your stuff, or scrapes your links, things will still point to your site instead of their site.

SEO folks will agree with the absolute url rule.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top