mcomo
Senior Member
Don't Be Denied The Success You Deserve!
Posts: 790
|
Post by mcomo on May 10, 2008 6:53:27 GMT -5
I am trying to help a friend. My site works fine, but I was trying to help her with the normal php redirect for dataentrymadeeasy.
She uses index.html
the php redirect that has been uploaded to the same directory as her index.html but it gives a server error.
I tried uploading an .htaccess file, but it does not help.
Mine works fine, but it's been so long ago I must have missed something. Any idea why hers would not work.
I was thinking perhaps she needed to be running php instead of .html, but I read on the forum that it does not matter.
I dont remember doing anything special other than the .htaccess file as far as ipower goes.
Any help would be appreciated.
Thank You, Mike C
|
|
|
Post by Tom "CloudHand" on May 10, 2008 8:26:43 GMT -5
In order for PHP code to work the file must have the .php extension. This informs the server to process the code as PHP. If the file has a .htm or .html extension the server will attempt to process the file as HTML and will generate an error when it tries to process the PHP redirect code.
If she has the PHP redirect code in the index file, it needs to be named index.php, not index.html.
|
|
mcomo
Senior Member
Don't Be Denied The Success You Deserve!
Posts: 790
|
Post by mcomo on May 10, 2008 8:49:27 GMT -5
In order for PHP code to work the file must have the .php extension. This informs the server to process the code as PHP. If the file has a .htm or .html extension the server will attempt to process the file as HTML and will generate an error when it tries to process the PHP redirect code. If she has the PHP redirect code in the index file, it needs to be named index.php, not index.html. Tom, Thank you for your response. This is not part of her index.html. It's a .php file as follows: <?php header("Location:http://www.keystrokes4cash.com/coupon/xxxx"); ?> It's a direct link to deme from a search engine. She simply has the link cloaked through her ipower account. I hope that makes sense. Mike C
|
|
|
Post by Sandi Moses on May 10, 2008 8:55:36 GMT -5
|
|
Nancy
Senior Member
I've learned...that it's those small daily happenings that make life so spectacular.
Posts: 957
|
Post by Nancy on May 10, 2008 8:59:48 GMT -5
;DMichael
Did she upload her php file to her public file? After I switched mine to php, I renamed it and saved it to a php extension, I then uploaded that to the public file.
Nancy
P.S. Sorry I see where you said she did do that.
|
|
mcomo
Senior Member
Don't Be Denied The Success You Deserve!
Posts: 790
|
Post by mcomo on May 10, 2008 9:11:11 GMT -5
;DMichael Did she upload her php file to her public file? After I switched mine to php, I renamed it and saved it to a php extension, I then uploaded that to the public file. Nancy P.S. Sorry I see where you said she did do that. Yes, it's really strange. The server encountered an unexpected condition which prevented it from fulfilling the request. The script had an error or it did not produce any output. I don't remember doing anything but uploading an .htaccess file to ipower. Very strange. Update: I took a quick look and noticed that for some reason the file attributes are not there and it's grayed out when I go to turn them on. I'll bet I need to talk to ipower. Thanks, Mike C
|
|
|
Post by troyzone on May 10, 2008 15:39:48 GMT -5
Mike,
Here is the code that I have for php redirects:
<?php
header( 'Location: http://your-link-here' ) ;
?> In the middle line, notice that there is a space after the colon in Location:, there is a space between the opening/closing brackets and the quotation marks at either end, and that the quotes I have are single rather than double quotes. I also have a blank line above and below the middle line, which is probably just to make the code more readable, but this is how the original code I got was so I left it *exactly* as-is except for the link.
I have my doubts whether most of these minor differences could cause any problems (someone like Tom who knows php code formatting better would be able to confirm), but the space after the colon may be needed and appears to be missing in the code that you quoted. Maybe it's not needed either, but as you know, it only takes a single incorrect character to keep code from working properly, so try making the code exactly the same as the example I gave above (other than the link of course) and see if that helps.
If not, then it may very well be an issue with her web hosting account or the server it is on. It has to have PHP installed on it, which most Linux web servers do, but if she's using a Windows-based web hosting account (typically an IIS server platform) then it may not have PHP installed unless it was specifically put on the server by the admin.
Troy
|
|
mcomo
Senior Member
Don't Be Denied The Success You Deserve!
Posts: 790
|
Post by mcomo on May 10, 2008 16:38:51 GMT -5
Mike, Here is the code that I have for php redirects: <?php
header( 'Location: http://your-link-here' ) ;
?> In the middle line, notice that there is a space after the colon in Location:, there is a space between the opening/closing brackets and the quotation marks at either end, and that the quotes I have are single rather than double quotes. I also have a blank line above and below the middle line, which is probably just to make the code more readable, but this is how the original code I got was so I left it *exactly* as-is except for the link. I have my doubts whether most of these minor differences could cause any problems (someone like Tom who knows php code formatting better would be able to confirm), but the space after the colon may be needed and appears to be missing in the code that you quoted. Maybe it's not needed either, but as you know, it only takes a single incorrect character to keep code from working properly, so try making the code exactly the same as the example I gave above (other than the link of course) and see if that helps. If not, then it may very well be an issue with her web hosting account or the server it is on. It has to have PHP installed on it, which most Linux web servers do, but if she's using a Windows-based web hosting account (typically an IIS server platform) then it may not have PHP installed unless it was specifically put on the server by the admin. Troy Troy, Thank you for your help. I actually found it about half and hour ago. I had to turn on CGI/Scripting in her account. They don't automatically turn it on with the new platform. I'm glad that is done. Thanks to all. Mike C
|
|