How To Keep A REFERER After Redirecting With .htaccess
When users click on a link such as /stuff/page5.html for example, when page5.html does not exist, i need to redirect to MyScript.php using the .htaccess (this works fine) but I need to hold on to the page5.html so I can make a better 404 page (and so i can be nitified of any 404 in order to fix them).
Using $HTTP_REFERER returns the original page that the user clicked on, and $REQUEST_URI returns "/stuff/My404.php".
I think what I need to do is somehow redirect to My404.php?BrokenLink=page5.html in the .htaccess but i'm not sure how to do this.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Referer
I'm looking for a way to change the refferer of the client clicking on a link to an external site. In other words, the external site should not see where the visitor is coming from, or even better, if i could manipulate the referer so that in their web-server's logs it will show as if they are coming from their own site. I've tried different ideas none of which worked.
404 Get Referer ?
Is it possible to catch the referer when using a 404 document ? for example, someone surfs to www.test.com/mkqjdfkjdfk mkdjfmqkd doesn't excist, so I want to catch this string to analyze it further on ..
Referer
Is it possible to get the page anchor name when using $_SERVER['HTTP_REFERER'];? So instead of mysite.com/one.html it'll show mysite.com/one.html#two
Referer?
I want to make something so that you can only see a page if you have been referred there by a certain page. For example www.bla.com/test.php can only be accessed if the page it was linked from was www.bla.com/test123.php. How would i go about doing this? You don't have to litrally write the code out if you don't want to, just an idea of what i have to learn/read in order to do this (i know basic php, been doing it for a while but ive had a big break so i don't remember much).
Finding Referer In PHP
I'm trying to determine the location a user has come from when they access a script of mine (a custom web logging script). I've searched the manual for 'referer' but can't find any relevant references and looking at output from phpinfo doesn't shed any light on which, if any, variables might hold info about where the user has come from.
Referer Header
I wasn't too clear about how the referer header works if sent on a php page on domain Z. Does it mean that it will send to the destination server a referer specified in the header, even if it is not the actual referer of the site? e.g. header("Referer: http://www.wanttosendthis.com"); header("Location: http://www.anothersite.com"); With anothersite.com show in it's logs the referer as wanttosendthis.com?
Getting Referer Of Script In PHP
I need to obtain the URL of the site that called one of my scripts. My code on client side looks like this: <SCRIPT type="text/javascript" src="http://example.com/scripts/apiscript.php?key=[hash of site]"> on server side, what do I have to do to get the referer (calling url), so that I can use it to calcuate the required hash?
Cache And Referer
if we click on back on this browser, this forum somehow refreshes itself. So I assume it uses something like cache. But what about sometimes, like we're filling up a form and click on submit than later realize we miss out something and this time when we click back, we get a "Warning, page had expired". So is this also using cache? If this two is the same case, how come this forum won't get affected by the expired page? For the HTTP_Referer, I'm sorry but can anyone show some example like how do we stick this function to remember every part of the click on our site link like this forum? I'm really desperate to know this answer and hope someone could just briefly go through these two functions to me (rather than send me to php.net or any site) I don't mean to repeat this and hope no one will get offended by this post. I just need a little explaination.
Http Referer?
I'm bulding this web site and I do not want other to link to my pages. I can use on every sinle page the http_referer to detect who's the referer and decide if I have to give access or not... but isn't there a better way of doing this instead of putting a piece of code on very single page ?
Page Referer Not Getting Set
I do web design for some small organizations, and one of the sites I have set up takes online conference registrations. Now, most of the time it works. In fact, every time I try it, it works fine. However, after having many complaints about it not working right, I finally discovered that some of my users do not have the page referer set when they request my page, and I was checking on the form submission page to make sure that the referer was the correct page. What could cause people to not have their referer set? What is the solution for this sort of problem? Just don't check the referer?
IP Lookup Or HTTP Referer
I want to know if there is a function that I can know the IP of a user. For HTTP_REFERER, I can get the URL from the user such as www.sony.com. BUT is there any way I can also know the IP of that?
Referer Based Allow/disallow
If referrer is internal (www.mysite.com), then show the page, else show an error message. Basically do not want outside link, and would prefer not to have direct link through the browser either.
Dynamic Http Referer
I have people coming to my site from the page http://www.domain.com/attn.php. If i put into the script that i should let anyone into my page coming from attn.php then if the URL is changed by the variable $check it doesnt let them in. What do i do to make sure that anyone coming from 'http://www.domain.com/attn.php?check=$anything' gets in? PHP Code:
Htaccess Needs Saving To .htaccess
Windows won't let me change htaccess-dist to .htaccess - saying it needs a file type..!! is there another way in which I can save it other than just trying to rename it.
Referer And Keyword Info Sent Via Form?
I've learned that HTTP_REFERRER, at least in my tests, returns the page visted on the current domain before the form page, not the domain visited before the current domain, so that hasn't been useful. I don't know how I would get keywords in this case. I've searched around for scripts or tutorials and have been surprised to find nothing helpful The site in question has a separate stats package, but it doesn't track converting keywords and that's really what I'm after. There isn't high volume traffic, so getting them individually via a form (rather than input into a database) isn't a problem. My question is really whether what I'm trying to do is possible with a few lines of code, or have I underestimated the complexity of the task?
Zone Alarm (pro) - Block Referer
i'm having troble with a script where i check referer, on a PC with Zone Alarm Pro the referer isn't send... i did a couple of page of testing and no referer is sand, closing ZAP the referer will work How can i solve this, do you know wich option is in zone alarm that dosen't
404 Error Referer Script Problems
I am having trouble extracting the original referer in my 404 error script. This is what I have so far: 1) I set the .htaccess file to the following and it works fine: ErrorDocument 404 /404.php 2) I've tried the following variables and they all produce the same results: $REQUEST_URI $HTTP_REFERER $REDIRECT_URL 3) The above mentioned variables all return "/404.php" and not the originally requested page.
Getting Page Referer Without Depending On User
I NEED the page referer for a script i've built to work, basicly i'm redirecting to my frames page with a line like this.. if ($m == "find") { $mainframe = $_SERVER['HTTP_REFERER']; } but i've been told that this data is sent from the user, so i need some way of telling my script which page to use as the main frame.
Check Referer - Call To Unsupported Or Undefined Function Error()
I have a Fatal error: Call to unsupported or undefined function error() in line 24 Line 24 is: error("Unauthorized access to: $HTTP_REFERER"); What I'm doing wrong? $referers = array('mydomain.com','www.mydomain.com'); function check_referer () { global $REFERERS, $HTTP_REFERER; if ($HTTP_REFERER != "") while (list($val, $ref) = each($REFERERS)) if (preg_match("/^http://$ref/", $HTTP_REFERER)) return; error("Unauthorized access to: $HTTP_REFERER"); exit; } check_referer();
Redirecting
There are 3 pages: A, B, C; B resides on another server. With Session variables I can share form data on A with C when I post directly to C. However, if I post to B and redirect to C, sharing doesn’t seem to work with C. If this is possible, what are the guidelines [i.e. what needs to be added beyond what was necessary when the form in A posted directly to C]?
Redirecting
How can I redirect a user to a certain page depending on some condition?(If it is true go to page 1 else go to page 2).Is it possible?
Redirecting To Another Page
Is there a way to call another page if a condition is met? For example - in psuedocode: "if variable X equals "1234", goto thispage.html. otherwise, goto thatpage.html"
Redirecting A User
I am looking to create a directory when a user logs in, and have that user redirected to their page logon. I have this script, which I haven;t implemented, but I would like your opinion. <script> // Define the URL for when the user is logged in $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); // Make sure there is no trailing slash if ((substr($url, -1) == '/') OR (substr($url, -1) == '') ) { $url = substr ($url, 0, -1); // Chop off the slash. } // Redirect to the page at logon $url .= '/' . $_POST['username'] . '.php' </script>
404 Redirecting Behaviour
I created a customize 404 error page (missing.html) and I add a line to .htaccess, so it looks like bellow: AddType application/x-httpd-php4 .php .php3 AddType application/x-httpd-php4-source .phps Action application/x-httpd-php4 /cgi-bin/php Action application/x-httpd-php-source /cgi-bin/php ErrorDocument 404 http://www.mysite.com/missing.html The problem that I have is that is working only for html file (when I point to http://www.mysite.com/foo.html the redirection works but when I point to http://www.mysite.com/foo.php it doesn't and I get an ugly 500 'Internal Server error'). Note: the permissions on .htacces were set by chmod 644 .htaccess .
Redirecting Between PHP Pages
Two inter-related questions: If I'm in PHP page a.php, and I want to switch control to page b.php, the only mechanism I've come across is to use header('Location: someURL") ; This has two drawbacks - it seems inefficient to me - you essentially have to "bounce" a request/response off the browser to switch between PHP pages - leaving and returning to PHP just to switch pages, and also it uses the GET method and, I'd assume, therefore restricts you on the length of the URL and therefore the number of name/value pairs you can send before they get truncated. Q1: Is there an internal PHP server-side page redirection mechanism that would/could provide a more efficient mechanism for switching between PHP pages? Q2: Alternatively, is there a POST equivalent to header("Location:") that I could use from within PHP to redirect between pages, so that the number of name/value pairs I could send is unlimited?
Redirecting To A New Page.
I am sending some posted form data to a php script that updates some mysql tables. I would like to know how to automatically load another php page or redirect to another page.
Redirecting Url To Another Page
i have three files: 1) calculat.htm 2) calculat.php3 3) out.php3 here calculat.htm contains the form , when i am submitting that form it goes to calculat.php3 there calculation will be done, and then it redirects the out.php3 file.
Redirecting The Page
I am using unset() to unset the session variables during logout page. When i click the logout button and when i click the back button, it showing the last page which i accessed but whn i click refresh or when i try to access the page its redirecting me to login page as the session variables are expired. I dont know why its not redirecting automaticaly once i click the button.My code:
Redirecting And Rewriting
I am trying like crazy to do this, but I can't find a way to do it. I want to open a url, and either replace part of it's body-tag, or add a piece of text to it. Is this at all possible? I know I've seen things like this done before, but I can't seem to find code for it :/
How Do I Stop Redirecting Myself
I've been playing around with redirect and cookies because I have a signup page I only want my visitor to see once. The problem now is that I can't go check on some of my pages because I get redirected - even though I've removed the script. Even if I try to enter a new redirect I still get sent to the first page I entered.
Header Not Redirecting
I am having a hard time with the header function.. if you look at the script below, both the 2 first header functions work no problem upon given cirumstances.. but as soon as I add the last header function, the first header function does not work.. it always reverts to the last header.. what am i doing wrong? Code:
Redirecting Pages.![HELP PLS]
what i wanted to do was when a user clicks on a submit button, admin page should veryfy which button was clicked and acroding to clicked button user should be redirected to a different page. So i did that using following codes:
Redirecting After Login
I have this code: $URL = str_replace('','',str_replace('','',$_SESSION["REDIRECT_AFTER_LOGIN"])); unset($_SESSION["REDIRECT_AFTER_LOGIN"]); Header("Location: $URL"); exit; The user is redirected, but session is unset. Example: you are at www.mysite.com/item.php?id=21 just browsing, but when you try to login and be redirected to this same item, you get www.mysite.com/item.php How do I get it to resume old session or not to unset it?
Redirecting To Last Page.
i use in the header to go to the last page if the script fails..... I do not what to go forward to the page again but backwards in The local browsers history.
Redirecting And Changing The URL
I have a login page which remembers what you were trying to access, then uses header('Location: url here') to redirect the user back to what they were trying to access after a successful password. However, the URL remains my.domain.here/login.php, instead of where they were redirected to... which breaks my relative links if they are redirected to a page within a subdirectory.
Redirecting Not Using Header
I am trying to Redirect from one page to another and it wont let me use... header( 'Location: http://www.yoursite.com/new_page.html' ) ; so is there any other way of doing this ?
Login And Redirecting
This is what I need to do, there will be a "LOGIN" button on the home page of the site, once a user clicks on that they go to a login page, once they login each individual user needs to be redirected to a specific page. So for instance, John will log in and he will see a page that was created for John only... There will be no more than 10 users. I dont need a registration page/form, I can create the users/passwords myself and then just give them out to each person... sounds like a simple thing, but I cant find anything only. I found one script but there were way too many options that I didnt need and it made the whole thing impossible for a beginner. I am not going to keep extremely sensitive and private info in there, so it doesnt need the highest level of security.
Redirecting On The Server Side?
I'm using PHP 4.4.4. After processing some data, I'd like to redirect to another page for further data processing. The way I'm redirecting right now is header("Location: next_page.php"); However, as you know this causes information to be sent to the client before the next page is contacted. Is there a way I can go to "next_page.php" without contacting the client?
Redirecting Google Output
We (our company) runs a few banner ad campaigns on Google. These campaigns are configures to be visible only in USA and Canada. We sitting hre n India are not able to see those campaigns runing on google..but our chaps in the US can. So i hit upon an idea to get the same pages as google shows in the US. 1> Write a PHP script that runs on a server in the US. That way the script reads a page which has the campaign running, as the IP google sees is a US IP 2> This script fopen's the page. ie the query string in google is a part of the page name. 3> Finally i read the whole page and then jsut send it back to myself sitting here in India. ***** But my fole pointers always turn out to be invalid. That is i am unable to open http pages using fopen. Any ideas here ??. Is there a setting in php which needs to be tweaked. ? When i ran phpinfo() on my server, it told me that virtual addressing was DISABLED.
Redirecting With POST Content
I want to redirect input from one page to another, but it's POST content. If it were GET, I could just do something like: header("Location: /new/form.php?a=1&b=2") I can't rewrite the destination script, because it's proprietary. And compiled. And for Windows. A few details might help: I'm using Imail's Web-based email interface on one site, and the only form inputs available to it are username and password. The existing form looks like this: <FORM ACTION="http://dom.ain:8383/login.cgi" METHOD="POST"> <INPUT TYPE="hidden" NAME="page" VALUE="login"> Username: <INPUT TYPE="text" NAME="userid"> Password: <INPUT TYPE="password" NAME="passwd"> <INPUT TYPE="SUBMIT" VALUE="Login"> (Obviously, I've stripped out some of the extraneous HTML markup.) What I'd like to do is: * Modify that form so that it POSTs to some hypothetical "login.php" page * Add an INPUT TYPE="CHECKBOX" NAME="SSL" CHECKED And have this hypothetical login.php act on the SSL variable, like this pseudocode: if((isset($_POST["SSL"])) && ($_POST["SSL"] == TRUE)) { redirect (https://dom.ain:8384/); } redirect (http://dom.ain:8383); Where redirect() is some fictitious function that would have to handle the other two POSTed variables. Again, if the destination form accepted GET, this would be trivial. It'd just be a matter of constructing a destination URL and sending a Location: header. But I'm not sure how to put all this together with POST, or if it's even possible. So, is it possible? Any pointers? I googled this, and found a number of people asking basically this question, but no good answers.
Redirecting User Via Post
I just made a script that gets a bunch of login info and I've come across a hurdle that I failed to think about it.. and now think I may have wasted my time... The login info I retreive needs to be POSTed to another site. Everything is beautiful, except now I don't know how to go about it.. I could use Location: URL but I have to chuck on the login info in the URL which would then be visible to the naked eye. Is there a way to POST it.. ?
Redirecting After N Seconds With Header()
I'm using header("Location: member_cp.php"); to send the browser back to a page - however, I would like to set a delay of, say, 2 seconds before redirecting. Is this possible with the header() function, or will I need to do this in a different way? If so, how?
Redirecting User To New Page
I am very much a new user and have a basic question. When the data is successfully submitted into the database, the script echos "Successfully submitted". If, instead, I wanted to redirect the user to another page, "confirm.php" , when the data is successfully submitted, how would i do that? PHP Code:
Exec And Redirecting Output
I've searched high and low on this group and elsewhere and can't really seem to find an answer to this question. I'm running PHP4 on a Debian box with Apache. I'm trying to run the "exec" command withsomething fairly simple like "cat", e.g. exec("cat < a.txt > b.txt");. I'm noticing that no matter what kind of redirecting/piping/whatever you want to call it I do, the redirections don't work (at least the redirecting of the output). I can run the same command from the command line and it works (of course). Is this some kind of permissions deal? I've tried making the call to be in places where a.txt and b.txt are in a directory that have R/W/X permissions for PHP (I chose a directory that I actually can successfully use the fopen et al commands with, including writing).
Redirecting A Url To My Server Locally
I have a domain that I want to point to my local server, so if I type in www.ebay.com, it doesn't go there, but to my apache server. I tried doing this in windows hosts file, added the line: 127.0.0.1 www.ebay.com But it just didn't work. I'm not sure what else to try, and was pretty sure that way worked - didn't do anything period. Does anyone know anything else to try?
Redirecting Echo Messages
I know why Headers Already Sent errors occur and I have put my processing at the top of the page to avoid this. However, the processing includes echo messages that will show if certain fields are not filled in or incorrect like this: Code:
Redirecting After Window.print()
i have a page that works like this: it gets a saleid from the url and echos the sale items according to the sale id, the thing is i set the the body onload to window.print(). and the page cannot redirect after the print dialog box appears as output is sent before redirecting. If i were to put a link on the page, then it would show on the printed page, so i want it to redirect after the dialogbox.
Redirecting Users If Try To Enter In A Different URL ??
I'm in the process of learning how to make a shopping cart. I'm making good progress but some things keep getting me off track. Here is one of those things... If a users going to a page that does not exist on the host how do I just direct them automatically to the home page. For example: www.yoursite.com/products/sdfgswfdgsgf.php "sdfgswfdgsgf.php" does not exist so I want to direct them to the home page at www.yoursite.com A real world example of this is at alienware.com -- if you type after the "/" anything it will simply direct you to the home page. This will help because getting an ugly error file not found message in awful. Also another question: (RELATED TO THE SAME AREA) When constructing my shopping cart I noticed that if someone is linked to and taken to: www.yoursite.com/products/index.php?product_id=3 the page will load fine. But if someone changes the URL to: www.yoursite.com/products/index.php?product_id=5555 I will have an error (I think it was an SQL error) ... How would I fix this so that it will just default to index.php OR EVEN BETTER Right back to the Homepage like the above question. I'm asking all of this because I want to prevent people from snooping around and trying things on my shopping cart if they wanted too.
|