Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Is it good to use absolute URLs?
November 4, 2004, 4:42 pm
rate this thread
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:
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...
....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
Re: Is it good to use absolute URLs?
> 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.