Custom Error Pages For Web Pages?
A site has the following htaccess commands in it for custom error pages:
ErrorDocument 400 /error.php?code=400
ErrorDocument 401 /error.php?code=401
ErrorDocument 403 /error.php?code=403
ErrorDocument 404 /error.php?code=404
ErrorDocument 405 /error.php?code=405
ErrorDocument 500 /error.php?code=500
ErrorDocument 501 /error.php?code=501
ErrorDocument 502 /error.php?code=502
ErrorDocument 503 /error.php?code=503
ErrorDocument 504 /error.php?code=504
So, there is one error page with php code in it. Depending on the error code that Apache sends, it will display the correct error message on the website.
However, if I type in http://www.domain.com/fdfdsfsdf.html I will get the error page correctly. However, if I type http://www.domain.com/fdfdsfsdf.php, it does not use the custom page, but using the default apache not found page. Is there something else I need to add to the htaccess file to make php errors use the custom page?
I was told by the owner of the hosting company I work at that every time apache sees a .php extension, it automatically assumes it is a script and will not parse the correct error message for it.
Does anyone know how to get .php extensions to use the custom error page on an apache server? Is there something else I can add to the htaccess file to facilitate this?
View Complete Forum Thread with Replies
Related Forum Messages:
Custom Error Pages
I'm just trying to set up custom error pages that will include the filename requested in the output, whether they typed in the url or it was from a link... I can't seem to get this to work. I've tried using php, javascript and perl and all with no luck... In php, $_SERVER["REQUEST_URI"] returns nothing in perl, $ENV{"REFERER"} also returns nothing in javascript, document.referer also returns nothing I haven't tested these with a 'bad link', they have all been tested by entering a non-existent page in the address bar. I need this to give me the file name only just so that I can include it on the resulting 404 not found page..
View Replies !
.htaccess Custom Error Pages
I am trying to create a .htaccess file in which to create custom error pages. Quote: ErrorDocument 400 http://www.humsci.auburn.edu/errors/badrequest.php ErrorDocument 401 http://www.humsci.auburn.edu/errors/authreqd.php ErrorDocument 403 http://www.humsci.auburn.edu/errors/forbid.php ErrorDocument 404 http://www.humsci.auburn.edu/errors/notfound.php ErrorDocument 500 http://www.humsci.auburn.edu/errors/server.php
View Replies !
Avioding Expired Pages, & Carrying Data Accross Multiple Form Pages
I have a checkout/order form that consists of 6 pages, all PHP. The are linked to one another, like, after the user finishes page 1, they proceed to page 2, etc... The first two pages are submitted by a GET link, so those are not in my question. The next 4 are submitted using a <form>. Throughout all of the pages, i would probably have about 25-30 variables, things that the user has to fill out. I have two questions, 1. What would be the best way for me to keep track of all the data moving throughout the pages, like storing it from page 4, and i still need to access it on page 6. 2. I don't know if anyone could help me here, but does anyone know of a way to code around those ugly "page expired" pages, because of a submitted form. If a user needs to go back, which most likely they will, is there some sort of way for me to skip the expired page?
View Replies !
Converting Html Pages Into Dynamic Pages
I built a website in html, using Dreamweaver. I need to have a database built within these pages and the person who is going to do it told me that they will have to convert all my html pages into dynamic pages (php). Is it complicated to do this or do I just have to save my pages in php instead of html in Dreamweaver ?
View Replies !
Error Pages
When a user clicks on a link on my page that points to a non-existing page he will be redirected to error/404.php (by .htaccess) How can I find the link that he was trying to follow, and the page on which that link was. If a user entered a non-existing url he will also be redirected but then only the wrong url can be fetched. How can I do that?
View Replies !
404 Error Pages
On the page which I redirect visitors to, when the file they are looking for does not exist, I want to catch the referrer URL, then strip it down to the page name only. Example: http://www.example.com/folder/some-page-name.html I want to grab the words "some-page-name" from that referrer URL.
View Replies !
Pages = 404 Error
I have recently installed phpBB2 and from my server it runs fine but wen i try to access the pages from another pc it either comes up page cannot be displayed or the page will partially load up and very rarley does it come out correctly, the same thing happens with my phpinfo.php file.
View Replies !
Error Pages Tip
I found the following article VERY useful: custom error pages with php delivering a 404 is fairly standard stuff, but it also describes a VERY easy way to deliver 301 redirects without any .htaccess and mod_rewrite voodoo. i was just faced with the prospect of redirecting 150 pages from one domain to a new one, and i had the 301 redirect set up within 30 minutes, with no need for any mod_rewrite regex at all (all checked with the server header checker on this site.
View Replies !
Convert The PHP Pages To HTML Pages
how to Convert the PHP pages to HTML pages. provide me the specificaly coverting Codes or Scrpit to Converted the PHP Page to HTML page. If there in any software to convert the PHP Page to HTML pages please specify.
View Replies !
HTTP_REFERER In Error Pages
I've made my own error page for 404 errors (error404.php) and added it to my .htaccess file. So far so good. This PHP script creates a log file containing all 404 errors, but I want to add the referrer from $HTTP_REFERER so I know who is referring to a page that doesn't exist anymore on my site. Just accessing $HTTP_REFERER won't work (this works only when from a local page on my site I access e.g. an image which no longer exists).
View Replies !
Error Pages With .htaccess
I've done the standard old trick of adding the error page line into ..htaccess which works absolutely fine if I accidently go to any file other than .php But if I go to "doesntexist.php" I get a different error message seemingly already installed somewhere on the server. Does anyone know how to override this? There must be a setting somewhere.
View Replies !
Includes And Error Pages
I have set up a basic include script and I would like to display an error page if the user types in an incorrect url but I don't know how to go about this... Here's what I currently use: elseif ($_GET['id'] == "1") { $page="1.txt"; } elseif ($_GET['id'] == "2") { $page="2.txt"; } else { $page="1.txt"; } include($page);
View Replies !
Internal Server Error On PHP Pages Only.
For the past week or so I have been getting some weird happenings with PHP installed on my Windows Server. I keep getting the "Internal Server Error" on PHP pages after about 19 or 20 hours of uptime. It's weird because it works just fine up until a certain point when it seems like it just wants to give up and not work. The HTML pages work just fine and so does the email and FTP that I also run on the server. There are no problems running PHP for the first 19 or 20 hours. When I get this error, I restart the server and it works properly again...
View Replies !
Generated 404 Error Pages And Googlebot
I have a "site search" program written in PHP. All works fine - except I am unsure of what to do for "empty" searches (specifically, what header code to return). Until now, when someone submits the form without entering any data, I have been returning a 200 OK header, and redirecting the user to the site homepage, so that the user can try again. I now read that this could cause problems, especially with Googlebot, and that I should be returning a 404 Not Found instead. So here is my confusion: User doesn't enter anything - I have to return something. But what? I do want to return the page he was on, so that he can try again, possibly adding a "try again" message. But what header code should I be returning?
View Replies !
Making Project Pages Error
When you see in sourceforge the projects pages you see http://sourceforge.net/project/[project_name]. I would like to do this in my site, but i've some problems to figure it out. When a new project is created, automaticly it will create a folder with is name, but then i create a php file to, so i can include the model of project page so i don't have to copy all of files, right? When a person writes - http://mydomain/project/[wrong project] how can i call a php file when this happens? so i could say like "no project with this name" or redirect to the main page.
View Replies !
Sending People To Specific Pages That Are Coming From Specific Pages...
I want to show some specific pages to people that comes to my site from specific urls, I know the variable $_SERVER['HTTP_REFERER'] will be used but how? For ex if the visitor comes from a site that is like: I want to send this person a specific.php . I used below code but not worked: <?php if($_SERVER['HTTP_REFERER'] == "www.cominghost.com" || $_SERVER['HTTP_REFERER'] == "cominghost.com" || $_SERVER['HTTP_REFERER'] == "www2.cominghost.com"){ // Specific page html goes here } else { header("Location: index.php"); } ?> This code not worked for some cases like if the visitor comes from http://www.cominghost.com/account/targeturl.php or http://cominghost.com/account/targeturl.php Ok I know the if statement not working but How?
View Replies !
Including Pages In Pages
When including a page inside another (include('page.php')), is it bad for the second document to also have <head> and <body> tags etc? Im using iframes currently, and it works, but getting the page to match the content is kind of a javascript hack that only works after the page is loaded, not counting the images. So the new page loads, doesnt fit the old page size, and its changed.
View Replies !
PHP Pages Getting 404 Error, "Page Cannot Be Displayed"...
I tried putting this into the PHP Installation forum but don't get any answers or suggestions there so I'm going to try it here and hope it doesn't get moved. I'm on a Windows 2003/PHP 5.22 setup. I'm TRYING to upgrade from PHP 5.02 which did work on my server and quite well. I followed the upgrading and installation instructions layed out on the PHP.net set -- I still can't get it to work. The install dumped all the PHP related files under "c:program filesphp". I've ensured that path is in my windows PATH statement for my env vars. I've also verified that "c:program filesphpphp-cgi.exe" is in my Web Service Extensions listing in IIS and the status is set to "Allowed". From the command-line, I can execute my "test.php" file that has the phpinfo(); info function in it and it works fine. It's only when I try to use my web browser to access the php file that I get the 404 error, "page cannot be displayed". I know that IIS in general is working ok because I can point it to the default http://servername/iisstart.htm and it resolves to that page just fine. It's only when I change it to http://servername/test.php (which has my phpinfo()) function in it when I get the 404 error. My web server just doesn't seem to be interpretting PHP files anymore and I can't figure out why.
View Replies !
Is There Anyway To Set A Custom Error Handler
Is there anyway to set a custom error handler which is actually a method of a class? i.e. setting the method eh() of class foo as error handler in the snippet below. class foo { function eh() { do something } } } Further more, how can I route E_ERROR & E_PARSE errors to my custom handler? I've tried 'error_reporting(E_ALL)' but non avail.
View Replies !
Custom Error Handling
I'm been looking at ways to add my own error handling capabilities to my PHP apps, but I'm not quite sure how to go about implementing it. For one, I only want to handle errors raised by trigger_error(), all others should be handled as normal by PHP, but this doesn't seem to be possible with set_error_handler(), if you do this, it seems you will have to handle ALL error types. Am I misunderstanding something here? Basically, I just want to have a handler for all errors created by trigger_error(), so whenever I call trigger_error(), I want my error handler to take care of it, otherwise I want PHP to print it's standard message.
View Replies !
Setting A Custom Error Log
I'm trying to set up a simple redirect for errors and log them to a custom file. I'm doing this for work on remote servers where I may not have access to their error.log. Anyway, the code I've written does not seem to be working. Errors are still being logged to the Apache logs, and I'm having a difficult time figuring out why. Here's the code I'm using: ini_set('error_log',"errorlog.txt"); I've checked file permissions, and everything is set to 777, so that shouldn't be an issue. I've also tried entering the entire path with the filename, but that didn't work either.
View Replies !
Custom Error Page
Is there a way with PHP to get the URL of the page you were previously on? For my custom 404 error page I want to be able to display what the URL was that wasn't found.
View Replies !
Custom Error Message
I am having an issue with php and IIS6 in that I want a custom error page to display when a page isn't found (error 404). If I do a test and enter anything ending with .php it returns the "default", bog standard IE / IIS error page. All other instances(.gif, .htm, <foldername> etc) route to the custom error page. What I need to know is where do I tell php the location of the custom error page to ensure it displays the custom 404 page rather than the default one.
View Replies !
Custom Warning And Error
I have not included one file and calling function from that file. so it gives me warning. now I in such case if I want to detect warning and put custom error message. This is because it shows our physical path on the page, which I want to prevent to see otheres.
View Replies !
Custom Error Script
I'm taking my first stab at a custom error handler. Here's what I've got but it takes a very long time to return. If I remove the die command it reutrns much faster, but then I get several error messages when I only want one. function ErrorHandler($code, $msg, $file, $line) { ?><h1>Something wrong has happened</h1> <? echo('<strong>Error: <em>' . $msg . '</emon line <em>' . $line . '</em></strong>'); $bt=debug_backtrace(); echo('<table cellpadding="2" cellspacing="1" border="1"><caption style="text-align:left; font-weight:bold; color:red;">Backtrack Report</caption><tr><th>Line</th><th>File</th></tr>'); for ( $i=0; $i<count($bt); $i++) { echo('<tr><td>' . $bt[$i]['line'] . '</td><td>' . $bt[$i]['file']. '</td></tr>'); } echo('</table>'); die(); }
View Replies !
On The Fly Php Pages
what coding you would use to create pages based off 1 template. For example http://www.mysite.com/index.php?page=1 http://www.mysite.com/index.php?page=2 http://www.mysite.com/index.php?page=3 So that I can edit changes to all my pages just be editing index.php. I don't have access to a sql database so I have tried different ways of using the echo command but no luck. Does anyone know how to do this?
View Replies !
Utf-8 Pages And Php 4.1.1
I'm running into a problem with php 4.1.1 on IIS (XP Pro version). For example writing a page test.php that starts with <?php session_start(); ?> <?php echo '<?xml version="1.0"' ?> <?php echo ' encoding="utf-8" ?>' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><!-- InstanceBegin template="/Templates/stdPage.dwt" codeOutsideHTMLIsLocked="true" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> .... and saving the test.php in UTF-8 format in UltraEdit-32 or SciTE, then running the page, there's a complaint for session_start() about headers/page data having already been sent. If the same page is saved as "plain" ASCII, it works. Any ideas how to get an UTF-8 encoded page to work in php 4.1.1, without upgrading?
View Replies !
Web Pages
i am trying to make a homepage in PHP but something along the same lines as the frames that you can use in HTML, so it allows you to have the different frames for opening different pages, but i was wondering how i would do that within PHP.
View Replies !
ASP.net Pages To Php Pages
Application developed on ASp.net, but now to be replaced with commercially available php application for purely commercial reasons, i.e. business building rather than application devlopment. Currently, domain is hosted in a purely MS environment , it has many pages rather well ranked in some SE's so we want to preserve those rankings .
View Replies !
Used Across All Pages
Given my web application has some codes that only need to be executed once(eg.configuration used over the whole site), but every php script which needs that config seems to execute that once to get configuration when a request comes. Is there any mechanism that can make a script processed only once and all other pages can use its output?
View Replies !
Pages Like This: *.php?do=something
I was wondering how peoples make scripts where you can show different things depending on the URL, but in the same PHP page exemple.php?myoption=showsomething would show something and exemple.php?myoption=showsomethingdifferent would show something different where could i find a begginner tutorial or something for that?
View Replies !
Around 40 Pages
My site has 2 languages English and French, now what is needed is that if the User is in abcd.php page which is in French and clicks on the English link he should go to the same abcd.php in English Language. How to do that is it possible cause I have around 40 pages means (80 in 2 language) .
View Replies !
PHP Pages
I'm building a form that gets processed on a second page, but upon processing failure should go back to page 1 and repopulate the form. My problem is that the data is too big to be base64 encoded and passed along the url. Is there a way I can have page 2 go back to page 1 and pass back the data without causing a 414 (url too big) error?
View Replies !
ASP Pages From PHP
I want to develop some code in PHP that is part of an ASP application. I am wondering if there is anyway to get the session ID of an ASP page (or any other scripting language) from PHP. I assume that session id's are kept as cookies on the user's desktop. If that's the case there should be some way of retrieving them.
View Replies !
Add Pages
I have used the search and also googled for this and can't seem to find anything relevant. Basically what I would like to do is auto add pages to what I suppose would be considered a guestbook script.(php and mysql) I understand how to LIMIT the results for a page but how do you auto generate extra pages? For ie: Say I have 20 records in my db that I wish to display, 10 records on each page. Now I know I could easily add a second page using conventional means (page1.php and page2.php) but I would like it to auto generate a third page link when another record is added. What I am trying to say is ONE page and links to other pages are generated when more records are added.
View Replies !
GUI Web Pages
My job is to automate things where in my web application was designed with php pages and mysql as DB in the backend. I should either use shell scripting or PHP scripting to get this done. I am not sure is there any way of doing. so, I really googled and got some tools which records and playback the actions but this is not useful for me as it won't make any logical decisions.
View Replies !
Need Php.ini To Enable Custom Error Handling
I'm trying to handle errors on my own. I copied this code from the PHP manual and pasted it at the top of my script, then took out a " from a string passed into a mysql_query(). Ran the script and still PHP outputed in its own message: Parse error: parse error, unexpected '"' in c:apachewwwfile.php on line 69 I wonder if there's something I need to do in the php.ini to enable custom error handling or something I missed out? PHP Code:
View Replies !
Error Checking Custom Forms
I am writing software that allows users to create custom html forms...when they place the forms on their pages using a display function the site visitor can fill them out. The info is passed to a processing page...it all works dandy if there are no errors. My question is, if there ARE errors what would be the best wasy to redirect the user back to the form..with the POST data in there. I have looked through the posts regarding headers and fsockopen and stuff like that....but I am not sure how to implement this. I can grab the $_SERVER['HTTP_REFERER'] from the form page....so I can send them back to the correct page. But I am unclear on the most efficient way to repopulate the form with the information they have submitted...in other words...how can I pass the data back to the form after realizing it had errors.
View Replies !
Custom Error Handler That Use Error_log()
I am trying to remove the error reporting from my site and have it email me errors instead. I have used a custom error handler that use error_log() to email me and I have set error_reporting to E_ERRORS. I was expecting itcustom error handler that use error_log() to only email me fatal errors (or rather, ones that it would have usually reported in the browser) but I'm getting loads of emails about errors that never caused any problems and are in code that I haven't written. If they are fatal errors (ie. E_ERROR) why aren't they crashing in the browser.
View Replies !
Php To Pdf Multiple Pages
I can write a page - no problem. when I start a second page I cannot open second page. at the time of a page break I have tried: php_close_page($sessionname) php_open_page($sessionname,x-coord, y-coord) and php_close_pdi_page($sessionname, $pagename) php_open_page($sessionname,x-coord, y-coord) and just php_open_page($sessionname,x-coord, y-coord) It always opens and writes the first page but hangs up when it tries to open the second page.
View Replies !
Secure Pages
I have a login system that checks the database for auth and sends them to the destination according to auth. Now what I need is some way to secure the pages so you cant go straight to the pages by typing it to the browser. I would like for you to get directed to the login page if you try to go straight to the page(s). Is there some code I can put to keep from viewing the page(s) without logging in first.
View Replies !
PHP In Html Pages?
I have a problem. I need to include a php script in a simple html document on a server that does´nt support php. I´ve tested following but it does´nt work.. <SCRIPT LANGUAGE="PHP" SRC="http://www.domain.com/include.php3"> Does anybody know a solution for this problem or is it impossible?
View Replies !
Can I Expire Pages Myself?
I was wondering weather it be possible to have the browser say page expired or if it is posiblw to have a script that will detect the browser back button has been pressed.
View Replies !
How To Redirect Pages
How can I redirect the URL if URL is underlined. I mean, I made alink to the site with URL. How do I change the site with URL, so that it redirects the browser to the page defined by that URL?
View Replies !
Members Pages On The Fly?
I would like to make a members site, where my members can update their personal page via the web through forums. The pages would be generated by a template. I would also like these member pages to have id=10 so that it is easy to link up.
View Replies !
Caching Pages With Php
In this post I will try to give a view of what is the custom caching with php, why and how we can use it.In the modern days, most of the sites are database driven. That means that your site is actually an application which retrieves data from a DBMS ( database managment system, eg MySQL) , parses the data and shows the result to the user. Most of these data are usually don't change frequently or don't change at all, and the reason that we use the database is that we can easilly update the site and the content.A problem that this process creates is the server overhead. Every time we execute a query in the database, the instance of our script will call the DBMS, and then the DBMS will send the results of the query. This is time consuming, and especcially for sites with heavy traffic is a real big problem.How we can solve this problem?There are two ways to solve this if you want to make your site faster. First is optimizing the quesries, but we will not talk about this at the present article. The second and most valuable is using some kind of custom caching technique. Custom caching with phpFirst let me explain the idea behind custom caching. When we have dynamic pages that their data is not updated frequently, we can use a 'system' that will be able to create the page, and then store it for later use. That means that after the page's creation, our application will not run the queries again in order to display the page, but it will show the cached one. Of course this system must be able to keep the cached pages for a time period that we will set.Let's code itHere is a simple class that will do the job. Let's see the code first:
View Replies !
Updating Pages
I have embedded a PHP script into an IFRAME that queries a MySQL database to post comments. Comments can be added, and in theory, posted immediately. They do if you hit F5, but as soon as I shutdown the browser, go back to the comments page, the new comments are not there, until I hit F5. I've deleted all the temp files from my computer, so it shouldn't be that. I've tried contacting my hosting company, but they have nothing useful to say.
View Replies !
Caching Php Pages?
HOW to make my pages freshly loaded by default. this is a problem when pages get cached that query databases because when you go there you get the cached page as opposed to the page updated with the database's info. how do you get pages to automatically load themselves from the server, not the cache?
View Replies !
Redirecting Between PHP Pages
Two inter-related questions: If I'm in PHP page a.php, and I want to switch control to page b.php, the only mechanism I've come across is to use header('Location: someURL") ; This has two drawbacks - it seems inefficient to me - you essentially have to "bounce" a request/response off the browser to switch between PHP pages - leaving and returning to PHP just to switch pages, and also it uses the GET method and, I'd assume, therefore restricts you on the length of the URL and therefore the number of name/value pairs you can send before they get truncated. Q1: Is there an internal PHP server-side page redirection mechanism that would/could provide a more efficient mechanism for switching between PHP pages? Q2: Alternatively, is there a POST equivalent to header("Location:") that I could use from within PHP to redirect between pages, so that the number of name/value pairs I could send is unlimited?
View Replies !
|