Forum Moderators: coopster

Message Too Old, No Replies

making subdomains through php.error file

is that possible?

         

ikbenhet1

7:57 pm on Nov 21, 2002 (gmt 0)

10+ Year Member




say someone wants to go to: subject.my_site.all/
Then he gets a [404] error since the page does not exit.

Can i make a 404.php file that outputs a [301] to www.my_site.all/subject/?

jatar_k

8:46 pm on Nov 21, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I don't think this is really the way to go about it.

These things (404,301) should/can be configured on the server. Any particular reason you want to do it through php?

aaronc

10:03 pm on Nov 21, 2002 (gmt 0)

10+ Year Member



I think you can do it with a header.

<?
header("Status: 301 Redirect");
header("Location: [domain.com...]
?>

I'm not sure why you would want to do it through php though.

ikbenhet1

10:22 pm on Nov 21, 2002 (gmt 0)

10+ Year Member



Yes, i want to do it in php because my webhost doesn't support subdomains.
And I don't want to mail them each time when i get subpage request to do a server 301 redirect, that would be too much for them, i need too many of them subdomains.
And php would be free, the only providers i know of that support subdomains charge per 5 subdomains.

what that needs to be figured out would be for ex:

subpage.domain.all
$sub='subpage' <-- how to get the subname in $sub

anothersubpage.domain.all
$sub='anothersubpage' <-- how to het the subname in $sub

and then

header("Status: 301 Redirect");
header("Location: [domain.com...]
?>

or something?