Forum Moderators: open
At the moment the internal URL paths within the scripts are referred to inconsistently, in a different ways, so firstly what we want to do is to comb through all scripts and make all internal URLs being referred to in an uniform way.
In this "tidy up", I am wondering what is the best to use, absolute paths (including domain name) or relative paths (but starting from root), e.g. should the internal URLs be:
href="http://www.example.com/widgets/widget.aspx"
img src = "www.example.com/images/widgets/blue-widget.jpg"
or
href="/widgets/widget.aspx"
img src = "/images/widgets/blue-widget.jpg"
Or does it not matter as long as we have full path starting from the root of the website consistently everywhere (i.e. no ../ ../../ ~ etc. in the path?
What are pros and cons of each?
I would like to add that once rewrite/redirect is implemented through db tables, it should also cater for domain wide page-to-page redirect from ccTLD to COM, done some months ago, as well as some other redirects done to fix URL capitalisation and few other mistakes. All of this is planned to be database driven rather than hardcoded as it is at the moment.
I have searched through previous posts but the information was from a few years back and also the opinions differed.
href="/widgets/widget.aspx"
img src = "/images/widgets/blue-widget.jpg"
href="/widgets/widget.aspx"
img src = "/images/widgets/blue-widget.jpg"
Changing hostnames as Ocean mentioned is one reason, another is moving pages, making a copy of a page to another location, all of the links will still be OK.
There is one case where I was told this cannot be done and the path is relative to the current folder. I was told that this cannot be done as this link is generated through .NET application. This place is the following line which is part of every .NET generated HTML:
<form name="Form1" method="post" action="widgets.aspx?id=7&lang=de" id="Form1">
I was told that the action= in the above line cannot be changed to start from root and that this is generated by .NET. I am not .NET programmer, could I have the advice if I should worry about this or not? I.e. will it break the links?
Below is the example of the folder structure we will be rewriting (environment: database driven redirect/rewrite, no ISAPI, IIS6, .NET 3.5).
If a request comes for:
www.example.com/resources/widgets.aspx?id=7&lang=de
This will be 301 redirected to:
www.example.com/de/green-widget
If a request comes for
www.example.com/de/green-widget
then this will be rewriten to
www.example.com/resources/widgets.aspx?id=7&lang=de
and passed on to application.
Question:
If in widgets.aspx the following line still has relative path as shown below, will it all still work?
<form name="Form1" method="post" action="widgets.aspx?id=7&lang=de" id="Form1">
Or is this going to be a problem and make the application break?
My understanding from what the development is telling me is that they have no control over action= attribute and that this is set up automatically by the server. I am not sure if they are running SP1, I will ask.
If the action= is not set up to friendly URL, and it stays without the full path from the root, would the application break?
My understanding from what the development is telling me is that they have no control over action= attribute and that this is set up automatically by the server. I am not sure if they are running SP1, I will ask.
If the action= is not set up to friendly URL, and it stays without the full path from the root, would the application break?