473,569 Members | 2,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is it good to use absolute URLs?

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
1 1809
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
9132
by: Joe Cybernet | last post by:
Is there any function for combining an absolute and a relative URL to result in an absolute URL? Like if I have http://www.domain.com and "../images/1.jpeg" it will evaluate to http://www.domain.com/images/1.jpeg. I know WinInet for windows has a function that does this called InternetCombineUrl, I just need the same function in PHP
3
3131
by: Peter Taurins | last post by:
Hi there. I have an included file (header.php) that contanis a reference to a graphic. If I stay at the root level, then I can control the relative path of the image. eg. images/imagename.jpg However, if I include this file (header.php) in a lower level directory then of course, I end up with no image displaying as the relative path is...
4
8941
by: Amir Eshterayeh | last post by:
Dear Friends My asp hyperlink goes to relative address instead of absolute. I like navigate url goes to outsite link like www.asp.net but now, it goes to www.mysite/www.asp.net please help. I create the navigatURL from database dynamically. I see the same question mentioned here but the response is not souitable for me: ...
0
1089
by: Flip | last post by:
I am retrieving a web page and then taking an inside table to display as an RSS feed. However, there are some relative URLs in there. Of course they work perfectly fine when using IE and navigating to the page. However when I scrape the html out, and load into a temp file, they longer work due to the relative urls. Is there an easy (ie a...
2
4854
by: Paul Bonfanti | last post by:
A customer of ours using .NET 2.0 on Win2003 is seeing relative URLs passed to Response.Redirect() being converted to absolute URLs in the Location header. For example '/test.aspx' becomes 'http://www.myserver.com/test.aspx'. We're not able to reproduce this on our machines. Does anyone know of a setting or configuration that would cause...
9
2569
by: volcano | last post by:
Can it be done, and if yes - how?
6
3146
by: Jon Slaughter | last post by:
do I have to prefix every absolute path with document root to get it to work? For some reason I thought that prefixing a path with '/' or './' with make it absolute w.r.t to document root but I guess not? e.g., when I do include './Scripts/AddNav.php';
2
2285
by: Stef Mientki | last post by:
hello, I'm trying to convert the links in html pages to absolute links, these pages can either be webpages or files on local harddisk (winXP). Now I've struggling for a while, and this code works a lilttle: i = line.find ( 'href=' ) if i < 0 : i = line.find ( ' src=' ) if i >= 0 :
1
1794
by: Nathan Sokalski | last post by:
I am using the System.Net.WebClient() and System.Text.UTF8Encoding() classes to get the output from another page of mine. My basic main algorithm is the following: utf8.GetString(source.DownloadData(finalurl)) However, it keeps telling me Illegal characters in path.
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.