Questions tagged [http-status-code-301]

The 301 or Moved Permanently error message is a HTTP standard response code indicating that the requested resource has been assigned a new permanent URI. Future references should use one of the returned URIs.

1797 questions
8
votes
2 answers

Canonical links and 301 Redirect if URL doesn't match slug

I am trying to implement a URL scheme similar to stack overflow's in django/python. E.g. the pk is stored in the URL along with a slug of the title so for this question (id #4787731) the URL…
Ryan
  • 23,871
  • 24
  • 86
  • 132
8
votes
3 answers

Use 301 Redirect In Google Blogger/Blogspot

I have a Google Blogger blog where I blog. Sometime ago, I posted a post but now after getting new data, I updated that post and I got new URL of that post. But I have a lot of backlinks to that old URL and now when they are htiing then they are…
user2904244
8
votes
4 answers

How do I redirect domain.com to WWW.domain.com under Django?

How do I go about redirecting all requests for domain.com/... to www.domain.com/... with a 301 in a django site? Obviously this can't be done in urls.py because you only get the path part of the URL in there. I can't use mod rewrite in .htaccess,…
Jake
  • 12,713
  • 18
  • 66
  • 96
8
votes
2 answers

How do you do a 301 permanant redirect route in ASP.Net MVC

How do you do a HTTP 301 permanant redirect route in ASP.NET MVC?
Rich
  • 93
  • 1
  • 3
8
votes
2 answers

301 redirects in Grails

I'm currently doing my Grails 301 URL-redirects using the following quite cumbersome "servlet style" method: def action = { ... if (shouldRedirect) { response.status = 301 response.setHeader("Location", "http://url/to/redirect/to.html") …
knorv
  • 49,059
  • 74
  • 210
  • 294
8
votes
1 answer

Can I redirect a local static html page to an online resource?

I'm writing a small application extension and the only way to include some help is by a local, static html page (like c:\program files\help.htm). I can't use PHP for it. Is there any way to redirect such a page to an online page?
RubenGeert
  • 2,902
  • 6
  • 32
  • 50
8
votes
6 answers

301 Moved Permanently

I'm trying to get HTML by URL in Java. But 301 Moved Permanently is all that I've got. Another URLs work. What's wrong? This is my code: hh= new URL("http://hh.ru"); in = new BufferedReader( new…
Tony
  • 3,605
  • 14
  • 52
  • 84
8
votes
2 answers

How do I use Scala dispatch to get the URL returned in a 301 redirect?

I am using Scala dispatch HTTP library, version 0.10.1. I make a request to a URL that returns an HTTP 301, permanent redirect. For example, http://wikipedia.com returns a 301 that redirects to http://www.wikipedia.org/. How do I do I use dispatch…
W.P. McNeill
  • 16,336
  • 12
  • 75
  • 111
8
votes
2 answers

nginx static index redirect

This seems ridiculous but I've not found a working answer in over an hour of searching. I have a static website running off nginx (which happens to be behind Varnish). The index file is called index.html. I want to redirect anyone who actually…
Ade
  • 2,961
  • 4
  • 30
  • 47
8
votes
2 answers

How to undo a 301 redirect?

Now, I don't have any problems with 301 redirects, but one person asked me for the way to undo cached 301 redirects for browsers and search engines, so I replied "by doing a 301 redirect back to the original url", at least thats what I thought was…
8
votes
2 answers

301 redirect from URL with query string to new domain with different query string

I am trying to figure out how to do a 301 redirect in my htaccess file to redirect some files to a new domain. Here's what I need to know how to do: OLD URL: http://www.example.com/index.php?page=news&id=2366 NEW URL:…
Sherwin Flight
  • 2,345
  • 7
  • 34
  • 54
7
votes
2 answers

301 redirect: Why connection close?

I learned to use Connection: close when doing 301 redirects in Java response.setStatus(301); response.setHeader("Location", "http://www.example.com/"); response.setHeader("Connection", "close"); Why do we do this? Why not omit the last line? I have…
700 Software
  • 85,281
  • 83
  • 234
  • 341
7
votes
2 answers

301 redirect with Webpack dev server

I'm trying to redirect urls from this format: http://localhost:8080/setup/xyz/?code=some-code to this: http://localhost:8080/app/#/setup/xyz/?code=some-code I've tried with both proxies and rewrites: historyApiFallback: { rewrites: [ { from:…
Costantin
  • 2,486
  • 6
  • 31
  • 48
7
votes
1 answer

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…
berkes
  • 26,996
  • 27
  • 115
  • 206
7
votes
3 answers

BHSM-Servlet does not let browser cache username

i have a requirement where a value should not be cached in the server nor the browser as an cookie over domains and sessions. So i choosed to permanent-redirect to the value Servlet: @Override protected void service(HttpServletRequest request, …
Grim
  • 1,938
  • 10
  • 56
  • 123