I need help with $_server(REQUEST_URI);

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
Gannyaa
-


Joined: 29 Sep 2006
Posts: 93
Location: Nelson, BC -- Canada

PostPosted: Mon Feb 19, 2007 3:57 am    Post subject: I need help with $_server(REQUEST_URI); Reply with quote

I need help with $_server(REQUEST_URI);

In another thread I found that 404 custom error pages could also
check via php the REQUEST_URI and pass the new url to redirect via php

That was and old topic ...
http://www.aprelium.com/forum/viewtopic.php?t=9763&highlight=php+redirect

But I like it and would like to implement it on my site for some 301 redirects.

$uri = $_SERVER["REQUEST_URI"];
$new_uri = $redirection[ $uri ];

I can't seem to get Abyss to recognize the .php extension to my error404.php file only the error404.htm version (Of course I set it in the Abyss Server console)

Just when I set the custom 404 to error404.php I get the generic Abyss error 404 page.

Do I have to set something in my PHP.ini file to get this to work?

the following code works but not the previous example.
$_SERVER["HTTP_HOST"];
_________________
Todd (Gannyaa)
http://iGannyaa.bebo.com/
http://haidavision.no-ip.info/gannyaa/newblog.htm
Back to top View user's profile Send private message Send e-mail Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Mon Feb 19, 2007 2:19 pm    Post subject: Re: I need help with $_server(REQUEST_URI); Reply with quote

Gannyaa wrote:
Just when I set the custom 404 to error404.php I get the generic Abyss error 404 page.


This usually means that Abyss Web Server was unable to find your custom error page. Are you able to browse it directly (http://mysite/dir1/dir2/error404.php )?
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Gannyaa
-


Joined: 29 Sep 2006
Posts: 93
Location: Nelson, BC -- Canada

PostPosted: Mon Feb 19, 2007 3:47 pm    Post subject: Figured it out... thanks anyways.... Reply with quote

Sometime posting a question answers it for yourself. Like after you have formulated the question, you see the answer in the question.

Anyways... instead of declaring the eror404.php page as an error 404, I used the error404.php as the default error page, and not specificially as an error 404 page.

Now it works.

So Should I add this to the bug report? that php doesn't work specifically with error 404 , whereas an html page with work with 404 error code. Both php and html pages work with the default error page.

Later
_________________
Todd (Gannyaa)
http://iGannyaa.bebo.com/
http://haidavision.no-ip.info/gannyaa/newblog.htm
Back to top View user's profile Send private message Send e-mail Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Tue Feb 20, 2007 11:31 am    Post subject: Re: Figured it out... thanks anyways.... Reply with quote

Gannyaa wrote:
So Should I add this to the bug report? that php doesn't work specifically with error 404 , whereas an html page with work with 404 error code. Both php and html pages work with the default error page.


We're not sure what the problem is but PHP scripts work fine as custom error pages. What is the source code of yours?
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
Gannyaa
-


Joined: 29 Sep 2006
Posts: 93
Location: Nelson, BC -- Canada

PostPosted: Tue Feb 20, 2007 12:52 pm    Post subject: here is my php source... Reply with quote

Here is my source:

Code:

<?php

/* Add in this array the list of (old path => new path) pairs */
$redirection = array(
   "/house/index.htm" => "/beach/index.htm",
   "/beach/house.htm" => "/beach/mainhouse.htm",
   "/beach/comment.htm" => "/beach/comments.htm",
   "/ns4/mainhouse.htm" => "/beach/mainhouse.htm",
);

$uri = $_SERVER["REQUEST_URI"];
$new_uri = $redirection[ $uri ];

if ($new_uri)
{
   header("Status: 301 Moved Permanently");
   header("Location: $new_uri");
   exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>

<title>Error 404 - Crescent Beach Web Server</title>
</head>

<body bgcolor="White" text="Black" link="Green" vlink="Green" alink="Lime">

<p align="center">ERROR 404 - NOT FOUND</p>

<br />
<hr>
<p>Powered by <b><i>Abyss Web Server</i></b> X1
<br />&copy; <a href="http://www.aprelium.com">Aprelium Technologies</a> - 2001-2006</p>

</body>
</html>


When I go to the Abyss Console to configure the custom error page, I use the default custom error page and browse for my error404.php file - Then it works.

If I use the custom error page, status code, and associated URL and add my error404.php page - Then I get an Abyss default error page and not my error page.

IF I use the custom error page, status code and associated URL and add an error404.htm page - the html page works fine.

Check it out.
_________________
Todd (Gannyaa)
http://iGannyaa.bebo.com/
http://haidavision.no-ip.info/gannyaa/newblog.htm
Back to top View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group