Skip to main content

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.

http-status-code-301
1582 votes
34 answers
3.9m views

How do I make a redirect in PHP?

Is it possible to redirect a user to a different page through the use of PHP? Say the user goes to www.example.com/page.php and I want to redirect them to www.example.com/index.php, how would I do so ...
Sam's user avatar
  • 18.9k
562 votes
25 answers
678k views

Generic htaccess redirect www to non-www

I would like to redirect www.example.com to example.com. The following htaccess code makes this happen: RewriteCond %{HTTP_HOST} ^www\.example\.com [NC] RewriteRule ^(.*)$ http://example.com/$1 [L,R=...
deepwell's user avatar
  • 20.8k
528 votes
19 answers
315k views

How long do browsers cache HTTP 301s?

I am debugging a problem with a HTTP 301 Permanent Redirect. After a quick test, it seems that Safari clears its cache of 301s when it is restarted, but Firefox does not. When do IE, Chrome, Firefox ...
Liam's user avatar
  • 20.5k
456 votes
8 answers
214k views

HTTP redirect: 301 (permanent) vs. 302 (temporary)

Is the client supposed to behave differently? How?
flybywire's user avatar
  • 269k
39 votes
4 answers
54k views

Apache 301 Redirect and preserving post data

I have implemented SEO URLs using Apache 301 redirects to a 'redirect.cfm' in the root of the website which handles all URL building and content delivering. Post data is lost during a 301 redirect. ...
Daniel Cook's user avatar
  • 1,043
278 votes
3 answers
104k views

What's the difference between HTTP 301 and 308 status codes?

What's the difference between HTTP 301 and 308 status codes? 301 (Moved Permanently): This and all future requests should be directed to the given URI. 308 (Permanent Redirect): The request and all ...
Alexander Drobyshevsky's user avatar
59 votes
7 answers
121k views

.htaccess 301 redirect of single page

After a site redesign, I've got a couple of pages that need to be redirected. Everything is staying on the same domain, just a couple of things have been reorganised and/or renamed. They are of the ...
Dan's user avatar
  • 926
39 votes
5 answers
45k views

Are 301 redirects possible using javascript or jQuery?

I'm running Apache 2.0 and I'm just wondering if it is possible to make a 301 redirect using JavaScript or jQuery. I have an <a></a> tag with href to a specified location and I'm asked to ...
Caleb Doucet's user avatar
  • 1,771
10 votes
3 answers
10k views

301 redirect .htaccess

How do I 301 redirect, for example: a subdirectory /Blog/ to /blog/ with .htaccess?
Wesley's user avatar
  • 101
28 votes
4 answers
59k views

Intercepting backend 301/302 redirects (proxy_pass) and rewriting to another location block possible?

We have a couple of backends sitting behind our nginx front ends. Is it possible to intercept 301 / 302 redirects sent by these backends and have nginx handle them? We were thinging something alone ...
anonymous-one's user avatar
20 votes
1 answer
36k views

.htaccess redirect without changing address bar

I'm trying to write an .htaccess rule to redirect to a script, which further redirects somewhere else. Kind of like how URL shorteners work. However, I don't want the address bar to change during the ....
aditya's user avatar
  • 1,978
14 votes
1 answer
34k views

Using regular expression in htaccess for 301 redirects

I have a Wordpress blog where I am redirecting blog posts from my old blog to my new blog in the format below: The old blog is called 'News' and the new blog is simply called 'Blog' - both exist on ...
Zabs's user avatar
  • 14.1k
8 votes
2 answers
38k views

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=...
Sherwin Flight's user avatar
3 votes
3 answers
14k views

301 Redirecting URLs based on GET variables in .htaccess

I have a few messy old URLs like... http://www.example.com/bunch.of/unneeded/crap?opendocument&part=1 http://www.example.com/bunch.of/unneeded/crap?opendocument&part=2 ...that I want to ...
user84643's user avatar
  • 379
6 votes
3 answers
22k views

.htaccess 301 redirect all pages on old domain to a single page on new domain

I'm looking to redirect each and every page on the old domain to a single page on the new domain. It should also redirect both the www and non-www versions. Every single request to the domain old.com, ...
Dan Horvat's user avatar

15 30 50 per page
1
2 3 4 5
11