1
vinit
.htaccess + Custom error pages + need more clearity .
  • 2004/8/11 6:59

  • vinit

  • Just can't stay away

  • Posts: 530

  • Since: 2004/1/10


hi,

just got few queries about the usage of .htaccess and errormessages.

1. Where do i put .htaccess file in root directory / or anywhere.

2. i have multiple sites hosted from same server spaces.
example
/foo ->www.foo.com
/bar ->www.bar.com

now i want to so different custom error msgs for both the directories is it possible.

3. What should be the permision of .htaccess file and also the error files.

Thanks

2
peterr
Re: .htaccess + Custom error pages + need more clearity .
  • 2004/8/11 9:41

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Hi,

Quote:

vinit wrote:
just got few queries about the usage of .htaccess and errormessages.

1. Where do i put .htaccess file in root directory / or anywhere.


In the 'web root' path, which is usually of the format /home/username/public_html

Quote:

vinit wrote:
2. i have multiple sites hosted from same server spaces.
example
/foo ->www.foo.com
/bar ->www.bar.com

now i want to so different custom error msgs for both the directories is it possible.


Maybe something like this in PHP

<?php

// If user comes to site with preceeding string "www." , remove it, not required
$httphostname $_SERVER['HTTP_HOST'];
$hostname str_replace("www."""$httphostname);

$error_messages = array(
   
'foo.com' => 'Error message for foo.com site',
   
'bar.com' => 'Error message for bar.com site'
   
);

if (isset(
$error_messages[$hostname])) $errmsg $error_messages[$hostname];
   else 
$errmsg 'No error message set';
?>


Quote:

vinit wrote:
3. What should be the permision of .htaccess file and also the error files.


Usually a 644 for .htacess, and also for the PHP script (error file)

Peter

Login

Who's Online

143 user(s) are online (98 user(s) are browsing Support Forums)


Members: 0


Guests: 143


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits