redirect

URL Fragment and 302 redirects

It's well known that URL fragment (the part after the #) is not sent to the server. I do wonder however how fragments work when a server redirect (via HTTP status 302 and Location: header) is involved. My question is really two-fold: A: If the original URL had a fragment (/original.php#foo), and a redirect is sent to /new.php, does the...

Redirecting someone

Hello. I want to redirect someone to index.php, how do i do this? But not the "meta" method, because it needs to be in header, and i can not have it there. ...

How to set cookies with redirect in Pylons

In light of the cookie-handling bugs affecting Safari and Chrome (see this thread), and Pylons implementation of redirect_to as an exception, is it possible to reliably set a tracking cookie and redirect at the same time? Is the META refresh method looked down upon? ...

Redirect assemblies in Mono?

Hello, I have recently discovered that I am affected by this bug http://www.mail-archive.com/[email protected]/msg71515.html Well, at http://www.mail-archive.com/[email protected]/msg71529.html they say the work around is to create a global policy assembly and redirect the assemblies that way since it is not read from ...

Redirecting to a diferent exe for download based on user agent

I own a Linux-Apache site where I host exe files for download. Now, when a user clicks this link to my site (published on another site): http://mysite.com/downloads/file.exe I need to dynamically check their user agent and redirect them to either http://mysite.com/downloads/file-1.exe or http://mysite.com/downloads/file-2.exe It seem...

Is there user agent detection code for none smartphones out there?

Hi all, I'm looking to write an ASP.Net MVC ActionFilter to redirect users of mobiles that aren't in the ambiguos smartphone category to our WAP site. Does anyone know of such code out there? I've found http://detectmobilebrowser.com/, http://mdbf.codeplex.com/ and http://www.51degrees.mobi/Products/NETMobileAPI already. I prefer the ...

curlpp: how to redirect output of method Perform to the file?

curlpp: how to redirect output of method Perform to the file? ...

How to open a link in the background ...?!

I need to open in the background of my page ( something like a iframe) a webpage that redirects to another webpage. So A is my main page and I want to open page B, that redirects to page C. So the page B and page C should be opened in the background, without user knowing. If I use iframe, my current page(A) gets redirected too to C and...

How to automate the setup/teardown of redirects in IIS?

For a while I have wanted to automate the setup of several redirects for an IIS-based web sites. What is the best way to achieve that? Note: I am planning to answer my own question as soon as SO will let me do that. I just want to make sure I can find this solution later and help others. ...

Redirect stderr to stdout on exec-ed process from python?

In a bash script, I can write: exec 2>&1 exec someprog And the stderr output of someprog would be redirected to stdout. Is there any way to do a similar thing using python's os.exec* functions? This doesn't have to be portable, just work on Linux. ...

Best practices for client side vs. server side redirects: When to use what ?

I understand that most of the languages support server side redirects (asp.net: Response.Redirect, PHP: header( 'newpage' ) ; ). You could also do a redirect with JavaScript (window.location.href="newLocationURL"). When would you choose one over the other ? With respect to ASP.net/IIS7(app pool in Integrated mode,enable 32 bit apps=fal...

Symfony: How to redirect to a new page in an AJAX call?

Hi, I've got jquery sending an AJAX request that executes some checks and then should EITHER redirect to another page or return data. Everything works fine except I'm unable to force the redirect in my actions file. I've tried: $this->redirect('@new_page'); // DOESN'T WORK And... $this->context->getController()->redirect('@new_page'...

How to redirect any /promotion/* URLs to just /* with .htaccess?

I need to redirect any requests to mysite.com/promotion/* pages to just mysite.com/*, so a few examples would be: mysite.com/promotion/some/page.html would redirect to mysite.com/some/page.html mysite.com/promotion/another-page.html would redirect to mysite.com/another-page.html How can this be done with .htaccess? ...

SharePoint2007 WebClient not handles redirection correctly

Hi All, I'm using .NET WebClient class to extract HTML pages from a SharePoint 2007 server. I can extract HTML content fine as long as there are no URL redirects. When there are URL redirects WebClinet class throws un-authorized exceptions. I have checked the network trace logs for my application and it seems the WebClient in fact han...

Pipe output of a command to an interactive python session?

What I'd like to do is something like $echo $PATH | python --remain-interactive "x = raw_input().split(':')" >>> >>> print x ['/usr/local/bin', '/usr/bin', '/bin'] I suppose ipython solution would be best. If this isn't achievable, what would be your solution for the situation where I want to process output from various other comm...

Redirect from login.jsp if already logged in

Hello If registered user jumps to login.jsp I wish to redirect him to youAreLoggedIn.jsp. Can this be made with <navigation-rule>? I know how to do this in PHP but not in JSP. When user visits login.jsp it must check if user is logged in this I know how to check. But how to trigger this action? Should I make a new servlet or what? T...

how to follow meta refreshes in Python

Python's urllib2 follows 3xx redirects to get the final content. Is there a way to make urllib2 (or some other library such as httplib2) also follow meta refreshes? Or do I need to parse the HTML manually for the refresh meta tags? ...

How to write .htaccess if django project is in subfolder and subdomain?

The path to my django site is: staging.ninjawebsite.com/clients/project/ I want that to be treated as the base url. The django project is in the public_html/clients/project subfolder. Everything seems to be working fine but all links to say /city/ should go to staging.ninjawebsite.com/clients/project/city/ but it goes to staging.ninjaweb...

Another .htaccess Question about redirects

I want to redirect /forums/uploads/profile/photo-thumb-[RANDOMNUMBER].jpg to a static no photo file like: /forums/uploads/profile/photo-thumb-none.jpg I know it can be done with .htaccess I am currently experiencing lots of 404 Errors. Thanks ...

Is this a correct way of doing a 301 redirect?

When I check my page using those online host header analyzers, the page says 200 OK. But when viewing in my browser, it redirects to another website (which is how I want it to be). The code that I use is: context.Response.Status = "301 Moved Permanently"; context.Response.AddHeader("Location", "http://www.example.com/article" + arti...