sergio
10-22-2002, 10:31 AM
How to modify htaccess in CPanel account, so custom error page will be a php file?
![]() | View Full Version : Custom error page to php sergio 10-22-2002, 10:31 AM How to modify htaccess in CPanel account, so custom error page will be a php file? SystemV 10-22-2002, 06:40 PM just add this line to .htaccess ErrorDocument 404 /err.php make sure that the path of php begins from the document root...and not to say..add one each for other errors.. hope this helps:) skelley1 10-22-2002, 06:44 PM if 'file not found' isn't the error you are meaning, change 404 to the error code you need. is this what you meant by 'how' or do you need more basic help as to how you edit a file? sergio 10-22-2002, 07:06 PM Originally posted by SystemV just add this line to .htaccess ErrorDocument 404 /err.php make sure that the path of php begins from the document root...and not to say..add one each for other errors.. hope this helps:) Thank you, I did it, but it doesn't work, should apache be restarted in order this to work, or something else? Can it be anywhere in .htaccess file? Doesn't it conflict with CPanel? skelley1 10-22-2002, 07:09 PM it should work, can you copy and paste your .htaccess here and we will look? SystemV 10-22-2002, 07:24 PM :) you should have "AllowOverride All" set ...or atleast "AllowOverride FileInfo" (for that particular directory tree) in your httpd.conf....and then restart apache.. sergio 10-23-2002, 08:46 AM Thanks everybody for answers. I managed to make custom error page for wrong page to redirect to php by putting url instead of file path, but how to do so that unkown subdomain also will show php error message? SystemV 10-23-2002, 04:45 PM :) if anything.domain.com resolves to domain.com, i dont think an error page other than the default will work....the reason is (I think;)) an unmatched subdomain will not have an virtualhost entry in httpd.conf...so the default error document for apache will be shown.. sergio 10-27-2002, 05:34 PM But how to change it so all undefined domains (*.mydomain.com) to redirect to mydomain.com ? SystemV 10-28-2002, 04:11 PM :) Just add this line to the end of the domains name record (along with the CNAME for mail, ftp and www) and restart named. * 14400 IN CNAME maindomain.com. sergio 10-28-2002, 04:47 PM Yes, but other subdomains will still work? And what to add to Apache config, because it's name based Virtual Host? SystemV 10-30-2002, 04:50 PM :) The entries in name records are just like that in httpd.conf(not in real sense)..the first entry get the preference.. ie * 14400 IN CNAME maindomain.com. last 14400 IN CNAME anotherdomain.com will make last.maindomain.com to point to the IP of maindomain.com and not anotherdomain.com, even if it is entered as a seperate CNAME. Note that * is above the entry for "last". ...this makes it clear the the line with * should be entered only at the bottom, or else you will loose all the subdomains afer it. Once you get the correct IP resolved for the subdomain, just add to httpd.conf like any other namebased entry with a ServerName as subdomain.maindomain.com. NameVirtualHost xxx.xxx.xxx.xxx:80 #this above all virtualhost entries with same IP <VirtualHost xxx.xxx.xxx.xxx> ServerName subdomain.maindomain.com ServerAdmin wwwadmin@maindomain.com[/email] DocumentRoot /home/user/www/subdomain_folder </VirtualHost> Hope this helps... |