Page 1 of 1

<a href 404 in localhost noob help

PostPosted: 07. March 2011 05:10
by scrtmtl
Xampp ver 1.7.4 Newest version.
Running vista in a localhost environment.
404 error means file not found.

I am working on an application. Everything is running fine. In that application, I am trying to create Term of Service web page.
Going nuts and on how to write a href code to not have a 404 error
Code: Select all
<li <?php echo $status; ?>> <a href="tos.html/">Term Service</a></li>


----
Try various dir path but still error. Thus I decided to use above code. Ran it and I got the 404 error in Mozilla. But in the fox browser I notice the address bar content http://localhost/Fcms/tos.html/

Code: Select all
<li <?php echo $status; ?>> <a href="http://localhost/fcms/tos.html/">Term Service</a></li>
I try this base on seeing the firefox address bar content. Again, 404 error. Thus in c:/xampp/htdoc/fcms/ folder, I have tos file place there (window shows name: tos type: firefox document).
----

Code: Select all
<li <?php echo $status; ?>> <a href="http://www.google.com/">Term Service</a></li>
get sent to google to confirm code works.

I know it is a rookie mistake of what to type for the a href=??? and appreciate your help. Tx in advance.

PS: When to use tos.html and tos.htm in the a href coding? In unrelated project, I try html and htm and accepted the one that works. Wondering when to use htm for I always believe to be html. Insight appreciated.
Can u please verify or provide the correct a href coding. I am going nuts for have to refresh applicate, refresh xampp, and
uncertain if my code is right. Again, tx and appreciate your help.

Re: <a href 404 in localhost noob help

PostPosted: 07. March 2011 05:31
by Sharley
<a href="tos.html/">
This is incorrect and needs the / slash removed as Apache is looking for a folder call tos.html not a file called tos.html and so chucks a wobbly and give you a 404 slapping. :)

<a href="tos.html">
is correct.

TIP
Make sure that you clear your browser's cache (Temporary Internet Files) when developing at localhost level or you could be served an old error page from the cache instead of your newly edited or corrected page content.

Good luck. :)

Re: <a href 404 in localhost noob help

PostPosted: 07. March 2011 07:28
by scrtmtl
Edit: Tx shirley for your reply. Normally, I solve with trial and error. But this one requires login, code changing, clear application cache, clear browser cache, refresh xampp and enter the correct information.

Still getting a wiping with the slash at end remove.

Code: Select all
<li <?php echo $status; ?>> <a href="http://localhost/fcms/aboutus.html">About Us</a></li>
   
$lang["antispam"] = "<a href='http://localhost/fcms/tos.html'>I agree to the Terms of Service..</a>"; // wrap Term & Condition with HTML link to  TOS


In folder C:\xampp\htdocs\fcms,
I have files
tos
aboutus
Type Firefox document



Firefox address bar
http://localhost/fcms/tos.html
http://localhost/fcms/aboutus.html

Firefox display with the above address bar
Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
07/03/2011 1:27:10 AM
Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
b

Please note. if I use "<a href='http://google.com/'>I agree to Terms of Service</a>", I am sent to google.com
tx

Will do clear application cache, clear fox browser cache, reinstall the plugin antispam with the tos, refresh xampp, then do a shutdown with vista to be on the safe side. Total clean to confirm no doublts. tx

Re: <a href 404 in localhost noob help

PostPosted: 07. March 2011 08:30
by Sharley
scrtmtl wrote:
Code: Select all
<li <?php echo $status; ?>> <a href="http://localhost/fcms/aboutus.html">About Us</a></li>
   
$lang["antispam"] = "<a href='http://localhost/fcms/tos.html'>I agree to the Terms of Service..</a>"; // wrap Term & Condition with HTML link to  TOS
You have created an anchor link to a folder fcms yet you have this folder named Fcms in the htdocs folder - Apache and most things in XAMPP are case sensitive - change one or the other so they are both the same and my advise is to use lower case for everything in XAMPP then you will not get confused.

scrtmtl wrote:In folder C:\xampp\htdocs\Fcms,
I have files
tos
aboutus
Type Firefox document

Firefox address bar
http://localhost/fcms/tos.html
http://localhost/fcms/aboutus.html
Can you see the difference?

Always check the \xampp\apache\logs\error.log file when you get errors from the server as it will give you more of clue what is wrong than the canned dumb response from a browser.

Best wishes and keep smiling. :)

Re: <a href 404 in localhost noob help

PostPosted: 07. March 2011 23:28
by scrtmtl
Tx shirley for your reply. Most important thing I should remember is lower letters. Apace log error file for better insight than browser. Resolve.