By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,273 Members | 1,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,273 IT Pros & Developers. It's quick & easy.

Is it good to use absolute URLs?

P: n/a
DM
I'm working on a site with more than 1700 HTML files. We'll be moving files
around on this site a lot because we're reorganizing it. I'm thinking of writing
a script that will convert all URLs in href and src attributes to absolute URLs
with this form:

href="/somedir/somefile.htm"
src="/images/somecategory/image.gif"

That way, if you move a page from one directory to another, the links and image
references within the page will not break. Also, if you move the entire site to
a different host, all the links will still work.

Is there anything wrong with this plan? Some people advocate relative URLs...

href="../../somefile.htm"

....but if you move a page containing such a link, the link will be broken.
Aren't absolute URLs better?

I've noticed that Dreamweaver's system for checking and updating internal URLs
is based on relative URLs. Does that indicate that relative URLs are better for
some reason?

Thanks,

dm
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Thu, 04 Nov 2004 10:42:01 -0800, DM <elektrophyte-yahoo> wrote:
I'm thinking of writing a script that will convert all URLs in href and
src attributes to absolute URLs ... Some people advocate relative URLs...


If the page to which you are referring will remain in the same place in
your directory structire forever, use absolute.

If the page may move, but will always share the same directory
relationship with the referring file, ose relative.

If either page may relocate, you're kinda stuck.

Use 301 redirects for the old page URL to redirect it to the new URL for
the benefit of outside links, and as a stop-gap measure before you update
all the links.
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.