Hi Friends,
I create my site http://www.padcilpharma.com its host on window server.
Its open with and without www.
I want its open with only www.
My host provider told me use phc scripting for that.
How am I do that...
Help
Help Me Site Redirect
Moderator: General Moderators
Re: Help Me Site Redirect
1) I can't get to your site.
2) What does "open" mean? "Accessible"?
3) Never heard of PHC.
2) What does "open" mean? "Accessible"?
3) Never heard of PHC.
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: Help Me Site Redirect
Take a look at $_SERVER['REQUEST_URI'] and inspect it to see if it contains the 'www' prefix. If it doesn't, use header() to redirect.
Re: Help Me Site Redirect
Why not just use htaccess?
- greyhoundcode
- Forum Regular
- Posts: 613
- Joined: Mon Feb 11, 2008 4:22 am
Re: Help Me Site Redirect
I assuming he isn't allowed to do this with his shared hosting account - "My host provider told me use phc scripting for that." (If phc is indeed PHP!) - though I guess that is an easier way to do it.LanceEh wrote:Why not just use htaccess?
You could have replied in this forum you know, rather than by PM. Not as if we're discussing state secrets or anythinglink2nayak wrote:I can't understand you.greyhoundcode wrote:Take a look at $_SERVER['REQUEST_URI'] and inspect it to see if it contains the 'www' prefix. If it doesn't, use header() to redirect.
Anyway, assuming you can't sort it via .htaccess like LanceEh says, what I was getting at was you could look at the contents of $_SERVER['REQUEST_URI'] (if this array element is accessible on your setup) and see if 'www.' is present in the address.
If it isn't, you can redirect the user using the header() function. If you're still unsure, take a look at the PHP manual's info on the $_SERVER array and its entry on the header() function.