redirect

redirecting with if statment based on cookie using header('location:') gives weird error in firefox

Hi. I am trying to redirect my visitors to for example http://localhost/site/test.php?lang=en_USbased on the country code in the cookie like this: if (isset($_COOKIE['country'])) { $country = $_COOKIE['country']; header('Location: test.php?lang=en_US'); if ($country == "NO"){ header('Lo...

.htaccess Redirection for Querystrings

Hi, I have an old website that URLs were like /page.aspx?sch=XXXX&prg=YYYY. I want to redirect those old URLs to my new website's URLs. I'm trying to use an .htaccess file to do the trick but I couldn't get it work. What I want is: /page.aspx?sch=XXXX&prg=YYYY ==> /page/sch/XXXX/prg/YYYY If someone could helped me, I'd be very please...

Will PHPs fopen follow 301 redirects?

We have a piece of legacy code that (ab)uses fopen() calls to resources over HTTP: @fopen('http://example.com'). We want to move example.com to another host and then send 301 Permanently Moved. However, we are not entirely sure if @fopen() will follow this. Initial tests show me that it does not. But maybe I miss some configuration pie...

Redirect help needed! Any tips/advice appreciated

Hi, this is my situation: I need to create an app that listens to URL's entered on a browser so that when a particular site is entered (e.g. google.com), it redirects this to www.mysite.com/Redirect.aspx?site=google.com, so that this click is recorded on mysite.com and then the user is redirected to the original entry i.e. google.com O...

redirect in 3 sec...

What do I have to do to have a function on a website where it says it will redirect you to the site in 3 seconds or so? ...

nginx - How to extract the domain name out of the full uri ?

Hi folks, i have a nginx server running on ipv6 native. I want to set up a "proxy" to ipv4 with it. server { listen [::]:80; location / { proxy_pass http://www.mydomain.com proxy_set_header X-Real-IP $remote_addr; } } The Idea is to set up a AAAA record "ipv6.mydomain.com", and nginx should chan...

.htaccess redirect only if ip address is not listed or not a specific url

I'm trying to setup a staging subdomain and only want to allow access to certain ip addresses, but allow everyone access to any url starting /api. What I have below works for the ip address, but always redirects if I try and access for example /api/projects or /api/users with an ip address not listed. Any help would be greatly apprecia...

How To Redirect site to a new domain and display moved message

Hi Im trying to move a webpage from one domain to another. Is there some way of doing the following, when a user gets into my page. Enters domainOld.com/aUniquePage.html Display domainOld.com/WeAreMoved.html Redirect 301 domainNew.com/aUniquePage.html Would that be possible with a .htacess and would google understand the 301 redirec...

How to recognize redirect and submit in struts action

Hi. My website use struts and tiles. I use this link to link to register form: <a href='<s:url action="register" namespace="/vtv" />' >Register</a> here is the register.jsp: <s:form namespace="/vtv" action="register"> <s:textfield label="Username" name="username" /> <s:textfield label="Password" name="password" /> </...

ASP.NET MVC2 - Redirect to Url in overriden controller

I've created a ControllerBase class that overrides the Execute method of the default Controller class. I'm doing this to check the url and pull an associated page from our database. If the page isn't found, I want to redirect to a specific url ("invalid-page"). All is working except the redirect. I've tried to use Response.Redirect("inva...

Rails: redirect two pages back

I'm trying to get my head around this one: Say you have two models where: :bar has_many :foos And you have a url like this: http://myapp.com/24-name-of-the-bar-to-param/foos/new On my site this page shows a lot of information about the bar which users are going to create a foo for. So, even if a user isn't logged in the user will sti...

How to display a web page just before Apache basic authentication (with exclusion list)?

I have web page running on the Apache. Web page is using Apache basic authentication. So when user tries to access certain page - must enter user/pass before to get authorised. I would like to display notification (except a list of IP addresses) screen with accept button just before authentication. Other comments on above: I can't sto...

Code Igniter Redirect Issues with GET parameters

I am having difficulty with code igniter routing. http://www.mysite.com goes to the right controller and does the right thing. However, http://www.mysite.com/?ref=p&amp;t2=455 causes a 404 error. Also http://www.mysite.com/mycontroller/mymethod/?ref=p&amp;t2=455 works fine. I changed the uri_protocol in the config.php file and tried...

How to redirect to pre-defined error page?

I have error page settings in my web.config like: <customErrors mode="RemoteOnly" defaultRedirect="ErrorDocs/500.htm"> <error statusCode="404" redirect="ErrorDocs/404.htm"/> <error statusCode="403" redirect="ErrorDocs/403.htm"/> </customErrors> Is there a simple way to redirect to 404 page without typing its name? Ex: Response...

How to follow a redirect after click_link/button with cucumber and capybara in rails?

I'm currently trying to set up integration/acceptance testing for a new rails 3 application with cucumber and capybara. (I initially planed to use webrat, but it seems that it does not support rails 3, so I ended up with capybara) I'm trying to get a basic login test working: Feature: Login user In order to access the non-public part...

Correct 30X redirect to use for arg remapping/expansion

I have a dynamically generated HTML page that uses Google charts. The things is that the page generator doesn't have easy access to the data the chart needs to display. So my thought is to have it instead generate a URL that encode what it does know and that point at another server that does have access to the data. This sever than gener...

Redirect PHP page to IMG

I have a blog background website. We provide some HTML code that the user can insert into his page, and it has something like this: <img src="http://site.com/img.jpg" /> Unfortunately, I have had to relocate the images from time to time. Each time I have to relocate the image, the image no longer works for the people who have put the...

Redirection of subdomains to mobile version

I'm trying to redirect all pages and subdomains by preceeding them with a m. subdomain unless it starts with a m. yet it completely fails. where am I going wrong? example.com or www.example.com -> m.example.com test.example.com -> m.test.example.com images.example.com -> m.images.example.com m.example.com -> Don't redirect m.test.exampl...

How do you separate visitors to two intro pages to compare amt of registration per visitor?

Hi. I am making a site that depend on users to register to be able to play my online game. If they don't login they only get to see the intro page. If the user login to the site I will save this information to the cookie so next time they visit they will be sent directly to the login.php. If the user don't have this information in the c...

Redirecting to another PHP page, then going back with filled fields

I have been needing a way to, once I redirect to a PHP page to review data, have the ability go back to the original page with the fields filled as they were before redirecting. I can think of several messy ways of doing this but nothing I am willing to do. Is there a standard way of doing this? ...