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.
Questions tagged [http-status-code-301]
1797 questions
2
votes
1 answer
Why isn't my .htaccess 301 redirect rule working?
I use URL rewriting on my redesigned website to give my pages tidier URLs.
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^$ index.php [L]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^.+/$ %{REQUEST_URI}index.php…

John Smith
- 23
- 4
2
votes
2 answers
htaccess one RewriteCond for multiple RewriteRules?
I have trouble with redirects in .htaccess.
I have several domains (example.com, example.net, example.uk). I have set of RewriteRules for each domain. But for some reason, the redirects works for all domains. Following is my tried htaccess rules…

Radek
- 21
- 2
2
votes
1 answer
Best practice for redirecting from one web domain to another in Grails?
I am currently working on a filter in Grails that will allow me to redirect all incoming requests on foo.org to the same subpage on foo.com.
So far I have been doing the following:
if(!(""+request.requestURL).toLowerCase().startsWith(
…

John Doppelmann
- 544
- 4
- 15
2
votes
1 answer
Gatsby with nginx - redirect is broken - trailing / (slash)
My gatsby site redirects to trailing slash and then redirects again back to non-trailing slash.
nginx config file:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
return 301…

Robin Wieruch
- 14,900
- 10
- 82
- 107
2
votes
0 answers
cache 301 redirect for a long time
I would like to cache a 301 redirect. Most of the questions are about how to avoid the cache.
I was thinking to add this in php :
$seconds_to_cache = 3600 * 60 * 24 * 1000;
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . "…

fefe42
- 21
- 1
2
votes
2 answers
SEO - Links and GET query strings
If there are a number of links to my web site like this:
www.domain.com/?linkid=101
www.domain.com/?linkid=102
www.domain.com/?linkid=103,
which all get 301ed to the same page, will these be treated by Google and other search engines the same way…

Mr. Flibble
- 26,564
- 23
- 69
- 100
2
votes
5 answers
Options for 301 redirect from blogger
I can't use .htaccess on Blogger, but I need to try to keep the search rankings for posts.
Users can redirect fine (using Javascript), but if I can't use a proper 301 redirect, how can I ensure Google doesn't have a fit and drop the rankings for the…

paimoe
- 707
- 7
- 16
2
votes
2 answers
301 htaccess redirects with 3 parameters to static urls
Im trying to redirect several urls with 3 parameters to different static urls with .htaccess but nothing…

Chris
- 21
- 2
2
votes
2 answers
Redirect multiple domains (http https www & non-www) to a new domain using htaccess
I have 3 different domains (with two different TLD) and I would like that all my domains redirect to only one (including all format http https www or non-www) -> https://www.newdomain.com
All my domains…

Yacasu
- 33
- 4
2
votes
2 answers
How to redirect domain path to other domain path using .htaccess?
The domains below are just sample domaains.
I want to redirect mydomain.com/test/ (wildcard) to google.com/dl (wildcard)
I am using this codes
RewriteEngine on
RedirectMatch 301 ^/test/.*$ https://google.com/dl
But when i access…

Cyberlicious
- 49
- 1
- 5
2
votes
1 answer
.htaccess - Redirect old website to main domain but also some content to subdomain of the main domain
I want to redirect an old domain (https & www) to the main one. I need to redirect it to the home page and blog. But, there are 4 pages on the old site I want to redirect to the subdomain of the main page.
How it should look:
Oldwebsite1.com ->…

Zuzka
- 21
- 2
2
votes
1 answer
service to 301 redirect from domain.com to www.domain.com
I'm about to write this code (using tomcat so I don't think there's an easy .htaccess solution), but figured I would see if there's already a service that does this for me. I need mydomain.com/* to be redirected to www.mydomain.com/*. So the…

at.
- 50,922
- 104
- 292
- 461
2
votes
1 answer
Can I use a 301 redirect for included external javascript files?
I am trying to clean up some files on a website, one task being to collate all references to jquery to a singular file.
Yes, it's a large site with multiple developers and some standards have not been followed resulting in the current situation…

dpmguise
- 718
- 1
- 4
- 10
2
votes
2 answers
How to rewrite URLs with Spring (Boot) via REST Controllers?
Let's say I have the following controller with its parent class:
@RestController
public class BusinessController extends RootController {
@GetMapping(value = "users", produces = {"application/json"})
@ResponseBody
public String users()…

maxxyme
- 2,164
- 5
- 31
- 48
2
votes
1 answer
Nginx -- if referer, add (x-forwarded-for) ip to blacklist
I have written a basic http referer redirector that looks something like this:
if ($http_referer ~* (google|yahoo|bing|duckduckgo)) { return 301 https://altavista.com; }
My goal is something like this
if ($http_referer ~*…

A_Elric
- 3,508
- 13
- 52
- 85