Hi all,
I've created a 404 page which seemed to be working well in most circumstances, for example:
http://www.p-s-i.org.uk/bad_page
However it was pointed out to be when the faux page appeared in a sub-folder, all CSS seemed to be lost. For example:
http://www.p-s-i.org.uk/links/bad_page
Does anyone have any ideas?
Thanks in advance,
Dave
PS - sorry for the validation errors!
14 1624
Good thinking, thanks Atli!
I don't suppose anyone knows much about DW to know whether they have a replace all function? Or whether it would be easier to actually create a css route for each subfolder?!
Thanks again,
Dave
Atli 5,058
Expert 4TB
If you change the link in all of your files to the absolute URL I posted they would all load the same CSS file, no matter where they are in the file structure.
In Dreamweaver, you can do "Edit->Find and Replace", change the "Find in" dropdown to "Folder", select the root folder for your web, put the old link on "Find", your new link in "Replace", and do "Replace all"... that should take care of all the links.
Thanks Atli.
I'm not sure if it's something I'm doing wrong but I gave that a go and it didn't seem to make any difference.
Speak soon,
Dave
So prepending a forward slash tells the browser to start from the web root?
Atli 5,058
Expert 4TB
Yes. A link starting with a forward slash is treated as an absolute URL, just like you had written http://example.com/ in front of it. (Assuming your page is located at example.com, obviously).
Atli 5,058
Expert 4TB
Thanks Atli.
I'm not sure if it's something I'm doing wrong but I gave that a go and it didn't seem to make any difference.
Speak soon,
Dave
What exactly did you do?
Can you show us an example?
I tried applying the solution to your pages using Opera's handy source modifying thing and it seemed to work.
I tried a few invalid URL's, like http://www.p-s-i.org.uk/links/bad_page, and simply replaced this: - <link href="css/css.css" rel="stylesheet" type="text/css" />
with this: - <link href="/css/css.css" rel="stylesheet" type="text/css" />
and the CSS loaded just fine every time.
Hi Atli,
This isn't something I've come across before.
I applied the change to all pages. So for example if you visit any page, the / is present in the code, for example:
http://p-s-i.org.uk/education/universities.html
But when you type in a non-existent URL the / is not present, e.g.:
http://p-s-i.org.uk/education/bad_page
I'm really not sure what to do on that..
Speak soon,
Dave
Atli 5,058
Expert 4TB
There must be a page somewhere that loads instead of the typical 404 error, when a user tries to access a page that doesn't exist.
You need to find that page and change this there.
If you are using Apache, you can find this by going into the configuration file (or the .htaccess file in your web-root) and find the "ErrorDocument 404" directive. That should point you to the correct file.
Thanks Atli. I don't know how it got missed from the find all.
Although now it works, it won't display any images. The struggle goes on!
My suggestion would be to make the image files and links all absolute on the error page. Then you should not have any problems.
Change: - <img src='banner.jpg' alt='some alt text' />
To: - <img src='http://p-s-i.org.uk/banner.jpg' alt='some text' />
I would also do the same thing with the links to other pages. This might seem like a headache now but will be a lifesaver when someone enters a url like http://p-s-i.org.uk/some_dir/another...ir/another_dir. The links will not be found and it will be a big circle.
--Kevin
Looks good, thanks Kevin.
Atli 5,058
Expert 4TB - <img src='http://p-s-i.org.uk/banner.jpg' alt='some text' />
I wouldn't add the "http//p-s-i.org.uk" part tho.
Like I suggested before, if you simply prefix a forward slash to the link, your browser should interpret that as an absolute URL as well.
That also makes you web more portable, because you will not have to go through all your code and change every link if this is every to be used on another domain.
This would be equivalent to the <img> tag you posted: - <img src='/banner.jpg' alt='some text' />
My suggestion was meant to be for the error pages only. That way you are assured it works regardless of what the user enters.
--Kevin
Sign in to post your reply or Sign up for a free account.
Similar topics
by: George Hester |
last post by:
Please take a look at this google artcle:
http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9
The op was having trouble with...
|
by: Ben Rush |
last post by:
Hello World,
Okay, I have spent the day browsing the newsgroups and reading up on
article after article concerning ViewState corruption and so forth, and I
have a couple questions. We...
|
by: MWells |
last post by:
I've encountered an interesting issue regarding Url encoding that I'm
hopeful someone can shed some light on.
I have some vanity Url's that have to contain filename content, using the
file...
|
by: Robert |
last post by:
I have a series of web applications (configured as separate applications) on
a server.
There is a main application at the root and then several virtual directories
that are independant...
|
by: 57R4N63R |
last post by:
I'm currently building a website for one of the client. There has been
few errors here and there, but just recently the problem is getting worse.
Basically the symptoms is that when the user try...
|
by: Charles Leonard |
last post by:
I am having yet another issue with Windows Server 2003. This time, the web
service (a file import web service) appears to run except for one odd
message: "ActiveX component can't create object". ...
|
by: Tom Anderson |
last post by:
I am currently having an issue with an ASP.Net 1.1 Web page that does the
following remotely but not locally.
Click on a control
Check for postback, if postback, handle the event, otherwise...
|
by: Paul |
last post by:
Hi,
I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so...
|
by: n3o |
last post by:
Hello Comp.Lang.C Members,
I have an issue with user input that I have been trying to figure out
for the longest. For instance, let's say you have something like this:
void foo()
{
int num;...
|
by: SAL |
last post by:
Hello,
I'm trying to include a popup in the ItemTemplate of a gridview row. The
ItemTemplate for the field contains a textbox and when the user clicks in
the textbox I want a popup panel to show...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |