|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Grab URI from address line?
I want to create a custom 404 error page. Lets say somebody tries to goto a page that is not on my serever: ww.abc.com/page1. I want to create a custom message that says : [www.abc.com/page1] is not located on this server. My server is running coldfusion.
Any suggestions would be greatly appreciated. Thanks in advance for the help
__________________
Dman www.concreteorange.com |
|
#2
|
|||
|
|||
|
in cfadmin set your missing template. in that template pull the CGI.Server_Name and CGI.Path_Info variables and output them like:
#CGI.Server_Name##CGI.Path_Info# |
|
#3
|
|||
|
|||
|
Page returns with no dynamic content
I inserted the code and then page returns but there is not any dynamic content being pulled? Any suggestions?
|
|
#4
|
|||
|
|||
|
whats not being pulled?? the cgi var's??
did u wrap those vars with cfoutput?? <CFOUTPUT>#CGI.Server_Name##CGI.Path_Info#</CFOUTPUT> is not located on this server. |
|
#5
|
|||
|
|||
|
Here is the code I am using. I tried it without the <cfset> and it did not help either.
Any suggestions would be great. My site is in my profile and the page is error.cfm. <p> The document you requested, <cfoutput> <cfset varURL = "http://" & #cgi.SERVER_NAME# & #cgi.PATH_INFO#> </cfoutput> was not found on this server. This error can occur when: <ul> <li> The webmaster of www.example.com moves or deletes a document <li> The URL is typed in wrong <li> There is a typo in a link on some other web page </ul> Please double-check that you typed in the URL correctly, if applicable. If you are unable to correct the problem, then you may wish to contact the web administrator of http://www.example.com. To do so, send your message to <a href="mailto:example.com">Example</a>. If you do send mail, <b>be sure and include the offending URL</b>, <cfoutput> <cfset varURL = "http://" & #cgi.SERVER_NAME# & #cgi.PATH_INFO#> </cfoutput> in the text of your message! <p> Alternately, you may return to the home page of <a href="http://www.example.com/">Example</a>. <p> <a href="mailto:mail@example.com">Send mail to example@example.com</a><br> <a href="http://www.example.com/">Visit the www.example.com home page</a> <p> |
|
#6
|
||||
|
||||
|
Try this instead...
<p> The document you requested, http://<cfoutput>#cgi.SERVER_NAME# #cgi.PATH_INFO#</cfoutput> was not found on this server. This error can occur when: blah blah blah
__________________
Military Singles Dating |
|
#7
|
|||
|
|||
|
Getting closer that pulls back the URI of the error.cfm page not the page that did not exist on the sever.
Here are the results:The document you requested, http://www.mavpac.com /error.cfm was not found on this server. This error can occur when: |
|
#8
|
||||
|
||||
|
perhaps the http_referer variable is what you are really looking for. try it instead of the pathinfo variable.
|
|
#9
|
|||
|
|||
|
Here is the code I used <cfoutput> #cgi.SERVER_NAME#/#cgi.HTTP_REFERER# </cfoutput>
It returns my server name but not the referer page that the error came from? Any ideas? |
|
#10
|
||||
|
||||
|
well, if you just typed error.cfm into the address bar, then there is no referrer page. it didn't come from a link on a previous page. i'm not sure there is a cgi variable that will give the nonexistant page name.
|
|
#11
|
|||
|
|||
|
But error.cfm is just a redirect of any 404 error. So error.cfm really never gets pulled just the invalid page. So what I need to be able to do is to pull the URI of the page that was orginally pulled.
Example: www.mavpac.com/help click here to see what I mean. error.cfm gets pulled but is not shown in URL box. |
|
#12
|
||||
|
||||
|
since the "page that was originally pulled" never really was pulled because it didn't exist, that probably won't work. the only way i can think of doing this that *might* work, is if you add a variable to all links that specifies the page name and then use that url.variablename in your error page. but this won't help if someone just types the wrong thing in the address bar and doesn't go through a link at all. I really think you will need to just stick to a more generic message such as,
the document you requested does not exist on this server. (without mentioning which document they requested) |
|
#13
|
|||
|
|||
|
Now when I use this code
<cfoutput> #cgi.SERVER_NAME# #cgi.PATH_INFO#</cfoutput> It shows the error.cfm page even though in the URL box is displays the page not found on server. |
|
#14
|
|||
|
|||
|
Dazzl,
I was trying but I guess you are right I will just stick to a generic page. Thanks for the help!! |
|
#15
|
||||
|
||||
|
here's a snippet of what I use for the 404 page on the Mikes of Chicago site (it's PHP):
Code:
<?
if(!$HTTP_REFERER) {
$source = USER;
}
elseif(substr_count($HTTP_REFERER,$SERVER_NAME) > 0) {
$source = INTERNAL;
}
else {
$source = EXTERNAL;
}
?>
<H2>
<?
if($source == "USER") {
echo "404 - incorrect URL entered";
}
elseif($source == "INTERNAL") {
echo "404 - Internal link broken";
}
elseif($source == "EXTERNAL") {
echo "404 - Invalid link from $HTTP_REFERER";
}
?>
</H2>
<?
if($source == "USER") {
echo "You seem to have typed the url incorrectly.<br>We will take you to our home page at <a href=\"http://$SERVER_NAME\">$SERVER_NAME</a>.";
}
elseif($source == "INTERNAL") {
echo "Whoops! We seem to have a broken internal link.<br>";
echo "Please tell the webmikester (<a href=\"mailto:webmike@mikesofchicago.org\">webmike@mikesofchicago.org</a>).<br>";
echo "We will return you to <a href=\"$HTTP_REFERER\">$HTTP_REFERER</a>.";
}
elseif($source == "EXTERNAL") {
echo "The page $HTTP_REFERER sent you to a page which doesn't exist on this site (${SERVER_NAME}).<BR>";
echo "You may want to tell the site's webmaster to correct the link.<BR>";
echo "We will take you to our home page at <a href=\"http://$SERVER_NAME\">$SERVER_NAME</a>.";
}
?>
|
![]() |
| Viewing: SEO Chat Forums > Other > SEO Scripts > Grab URI from address line? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|