GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   apache technical question anyone!? (https://gfy.com/showthread.php?t=363298)

MrJackMeHoff 09-27-2004 10:09 PM

apache technical question anyone!?
 
Sorry a bit off topic but im in a pinch to find this.

How do you pass the broken link in a 404 to a script? Here is an example:

ErrorDocument 404 404/404.pl?brokenlink=$LinkITried

masterE 09-27-2004 10:18 PM

Use REQUEST_URI

PHP Code:

brokenLink=<!--#echo var="REQUEST_URI" --> 


EscortDate_Enoj 09-27-2004 10:20 PM

Quote:

Originally posted by MrJackMeHoff
Sorry a bit off topic but im in a pinch to find this.

How do you pass the broken link in a 404 to a script? Here is an example:

ErrorDocument 404 404/404.pl?brokenlink=$LinkITried

I use
Code:

ErrorDocument 404 /index.php?module=error&code=404
and then when index.php is requested by Apache the environment will be as if the file which was not found existed. Take a look at for example the $_SERVER (PHP example) array when you request a 404 file.

I've seen it behave otherwise on other servers though, where the user plainly gets redirected to the 404 page instead. I assume it's some Apache directive for how to show error documents.

MrJackMeHoff 09-27-2004 10:22 PM

Quote:

Originally posted by masterE
Use REQUEST_URI

PHP Code:

brokenLink=<!--#echo var="REQUEST_URI" --> 


This doesnt do anything 'cept pass the acho command.. Im needing this for .htaccess.. I tried using php as the 404 and invoking request_uri but all i get is the current script name or the html it came from. Not the link that was 404 to begin with.

MrJackMeHoff 09-27-2004 10:24 PM

Quote:

Originally posted by EscortDate_Enoj
I use
Code:

ErrorDocument 404 /index.php?module=error&code=404
and then when index.php is requested by Apache the environment will be as if the file which was not found existed. Take a look at for example the $_SERVER (PHP example) array when you request a 404 file.

I've seen it behave otherwise on other servers though, where the user plainly gets redirected to the 404 page instead. I assume it's some Apache directive for how to show error documents.

php is only showing the php as the link I requested on my server. Not the link I really wanted.

masterE 09-27-2004 10:32 PM

Setup a normal 404 page, then request the script in your 404 page with an image tag using the REQUEST_URI

MrJackMeHoff 09-27-2004 10:35 PM

Quote:

Originally posted by masterE
Setup a normal 404 page, then request the script in your 404 page with an image tag using the REQUEST_URI
Say what? Oh I just found out I cant use php anyway it has to be perl.


there isnt just a fucking variable in apache to pass this? Geez why does this have to be so difficult? ;)

andi_germany 09-27-2004 10:40 PM

You have to edit your httpd.conf and and uncomment or add the ErrorDocument 404 directive. This can be set global or in your virtual section.

ErrorDocument 404 /404.html works as well as a external redirect with a complete URL. (note that in this example 404.html would have to be present in your document root dir.)

There should be some example lines in your httpd.conf

If you don't have access to your conf files you can also use .htaccess to forward the404 errors

lb_vee 09-27-2004 10:41 PM

Quote:

Originally posted by MrJackMeHoff
Sorry a bit off topic but im in a pinch to find this.

How do you pass the broken link in a 404 to a script? Here is an example:

ErrorDocument 404 404/404.pl?brokenlink=$LinkITried

try adding a slash in front of the first directory.

lb_vee 09-27-2004 10:46 PM

I just realized you're trying to pass a variable to it.

The referer will be picked up by the script automatically. If you're using perl as cgi, look into the CGI.pm docs to see how its passed.

If its mod-perl, checkout the Apache::Registry docs

I think the refering url is also an @ENV variable.

$ENV{'HTTP_REFERER'};

Replace the haha shit up top with a shift+[

Theodor S. Geisel 09-27-2004 10:48 PM

Quote:

Originally posted by MrJackMeHoff
Sorry a bit off topic but im in a pinch to find this.

How do you pass the broken link in a 404 to a script? Here is an example:

ErrorDocument 404 404/404.pl?brokenlink=$LinkITried

2 things you have to keep in mind.

1. Make sure everything is relative. /404/404.pl is a good start.
2. IE will *NOT* show your custom 404 page if your 404 page is less than 10k. You can just fill the damn page with dots. That'll work.

MrJackMeHoff 09-27-2004 10:59 PM

Quote:

Originally posted by a1escorts
I just realized you're trying to pass a variable to it.

The referer will be picked up by the script automatically. If you're using perl as cgi, look into the CGI.pm docs to see how its passed.

If its mod-perl, checkout the Apache::Registry docs

I think the refering url is also an @ENV variable.

$ENV{'HTTP_REFERER'};

Replace the haha shit up top with a shift+[

I dont want the referer I want the link you click on that is dead so i can work with it in perl. I have the referer already. ;)

MrJackMeHoff 09-27-2004 11:00 PM

Quote:

Originally posted by Theodor S. Geisel
2 things you have to keep in mind.

1. Make sure everything is relative. /404/404.pl is a good start.
2. IE will *NOT* show your custom 404 page if your 404 page is less than 10k. You can just fill the damn page with dots. That'll work.

The script runs fine just no way to display the link that was dead in the first place.

lb_vee 09-27-2004 11:12 PM

Quote:

Originally posted by MrJackMeHoff
The script runs fine just no way to display the link that was dead in the first place.
in the environment variables, look at REDIRECT_ERROR_NOTES or REQUEST_URI, thats the page that called the 404 (the page that doesnt exist)

MrJackMeHoff 09-28-2004 12:13 AM

Quote:

Originally posted by a1escorts
in the environment variables, look at REDIRECT_ERROR_NOTES or REQUEST_URI, thats the page that called the 404 (the page that doesnt exist)
No matter what I do I just get the page the person was last on or the page they are currently on I cant seem to get the page they wanted to be on that was 404.

lb_vee 09-28-2004 12:28 PM

Quote:

Originally posted by MrJackMeHoff
No matter what I do I just get the page the person was last on or the page they are currently on I cant seem to get the page they wanted to be on that was 404.
does the 404 redirection work??

I tested this on one of my servers and it works fine. Double check your perl / apache settings.


All times are GMT -7. The time now is 02:32 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123