Questions tagged [301-redirect]

The HTTP response status code 301 Moved Permanently is used for permanent redirection. This status code should be used with the location header.

Filter by
Sorted by
Tagged with
0 votes
2 answers
228 views

Is it better to redirect root to www or www to root?

This may be a 'fashion' question, but is it better to redirect: https://www.example.com -> https://example.com or https://example.com -> https://www.example.com? I always assumed it was better ...
J. Gwinner's user avatar
0 votes
0 answers
52 views

subdomain redirect best practices

I'm setting up a site served by Nginx on FreeBSD. The only content is at sub.example.net, and I'd like to 301 any requests to example.net, www.example.net, and www.sub.example.net. My current solution ...
MonocleRB's user avatar
  • 101
0 votes
1 answer
47 views

NGINX domain conf file, how to redirect 301 and proxy_pass

I'm pretty new to nginx and I'm trying to configure a redirect from http to https and, in the same file, set as location a proxy_pass to the desired URL. My domain.com file is this: server { ...
Alessandro75's user avatar
0 votes
1 answer
69 views

Weird 301-redirect to http from https only happening with CF as proxy on /wp-admin on www subdomain

I have a wordpress blog on an EC2 instance on AWS using the AMI image aws-marketplace/bitnami-wordpress-6.3.2-6-r09-linux-debian-11-x86_64-hvm-ebs-nami-7d426cb7-9522-4dd7-a56b-55dd8cc1c8d0 In ...
user1015149's user avatar
-2 votes
2 answers
39 views

301 redirect the old domain with a certain link to a new domain with the same link

I have a problem, I want to redirect htaccess The content of domainold.com is still used, only this URL has changed from the Old website, namely http://domainold.com/product/register to my new site, ...
Project Downgrade's user avatar
0 votes
1 answer
70 views

nginx redirects with changed response code

I am trying to redirect any location that gives 404 to the front page and change the response code to 302. According to nginx documentation this should be possible? https://nginx.org/en/docs/http/...
7fc9ecfc6810c58545e1bc3b556003's user avatar
1 vote
1 answer
37 views

Redirect removing sufixes after 3 URL segmentes in Nginx

This is the URL that I need to remove the last segment (?order=asc) https://www.example.com/segment_1/segment_2/page/the_number_goes_here/?order?asc This is the code I'm trying: location ~ ^/([^/]+)/(...
btgen's user avatar
  • 11
1 vote
1 answer
115 views

How to remove amp word from center of url

I removed Amp Module from our site and I need to remove amp word from center of all of urls. Using Nginx Web server for example : mysite.com/shirt/nike?amp=1&product_list_dir=asc&...
peyman peymani's user avatar
0 votes
1 answer
557 views

NGINX redirect returns 414 Request-URI Too Large

I'm not an NGINX's expert, I'm trying to redirect an entire website from a domain to another domain. To test the solution in local I'm using two different urls: fake old domain -> 127.0.0.3 fake ...
MaxDragonheart's user avatar
1 vote
1 answer
57 views

how to write 301 redirect by checking an special character from the url using htaccess?

I have few urls contain some special characters like below www.abc.com/archive/category/コレクション-帯-袋帯 www.abc.com/archive/category/お役立ち情報 I want to write .htaccess to handle this redirection. I tried ...
Khan Emir's user avatar
0 votes
1 answer
69 views

Is it possible to set up .htaccess rule for incoming traffic from 301 redirect?

We have a permanent 301 redirect that is set up for an old site that is now being redirected to a page on a new site. Is it even possible to set up an .htaccess rule on our new sites Apache server to ...
deeholzman's user avatar
0 votes
0 answers
36 views

can't block a domain which is redirected by aws

This is my first year at university and This is also my first time trying to configure a server. They want me to block some https-web. I was able to block all websites with iptables except one. I'm ...
endiku's user avatar
  • 1
1 vote
1 answer
145 views

Redirecting specific subdomain with NGINX to point to a different website while using SSL

I have the following NGINX configuration: # HTTP Redirect server { listen 80 default_server; listen [::]:80 default_server; server_name _; return 301 https://$host$request_uri; } # ...
Rietty's user avatar
  • 113
0 votes
1 answer
100 views

Redirecting subdomain to another domain

I have a subdomain, sub.domain1.com. I want to redirect this to domain2.com. The result is a security exception because the certificate on domain2.com doesn't include sub.domain1.com. How does one ...
Mars's user avatar
  • 101
0 votes
0 answers
100 views

Apache2 http https redirect not working (ErrorDocument or 400 Bad Request)

I'm trying to redirect http to https I have sevral sub domains and use sevral port. I wnat to redirect 80 port to 443 port automatically. I have httpd.conf / vhosts.conf / ssl.conf so when i type ...
allison000's user avatar
0 votes
1 answer
415 views

How can I configure Nginx to redirect all traffic to my website to the HTTPS WWW version and HTTPS version for subs with a consistent URL structure

What I am trying to do is to have some clean redirects and don't make the content from the server available everywhere like is available via https://server-ip https://non-www and https://www-version I ...
Crypto Coupons's user avatar
0 votes
0 answers
97 views

Site with subdomains in redirect loop - Nginx configuration Issues

this is the website (the website also have subdomains) nginx configuration: # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to ...
Crypto Coupons's user avatar
0 votes
2 answers
92 views

Nginx permanent redirects from subfolder

What im trying to achieve is redirects from mysite.com/en/something/something1 to mysite.com/something/something1 is there any way to remove static subpath /en/ from the url using nginx conf?
Erzsebet113's user avatar
0 votes
1 answer
53 views

Nginx custom 301 rewrite

I am struggling to find how to write this scenario 301 redirect to nginx: https://mydomain/$ to be converted https://mydomain/en_us/$ Actually I need to add "en_us" just after mydomain and ...
G. G.'s user avatar
  • 143
0 votes
1 answer
1k views

How to redirect all pages that contain a specific word using the .htaccess file

I have a bunch of indexed pages that start with the same word and they are all 404 so I want to redirect them all to the homepage of the site. The server is Apache, so I would like to use the ....
Petar Cvetic's user avatar
1 vote
1 answer
736 views

Redirect all URLs ending in ".-detail" to remove the dot

I have a rather odd situation where our old URLs are ending in .-detail and need changing to just -detail. For example: example.com/product.-detail needs changing to example.com/product-detail In ...
markbarabus's user avatar
0 votes
1 answer
270 views

RegEx for 301 redirects to change path AND remove a string

I am looking for an RegEX redirect rule to redirect the image file locations to a new location, whilst also removing part of the original url which is the name of the image OLD URL: /components/...
Rebecca Hubbard's user avatar
2 votes
2 answers
3k views

.htaccess - Redirect all URLs with one exception

I want to redirect all URLs from one domain to another. Some of the old URLs have new counterparts with specific pages to redirect to. All other URLs should redirect to the homepage of the new domain. ...
Cray's user avatar
  • 135
1 vote
1 answer
874 views

htaccess: 301 redirect defined URLs to new domain and catch all redirect the rest

I want to redirect some URLs from an old domain to new versions on a new domain. The old domain uses the www. subdomain and SSL. For example: olddomain.com/audi -> newdomain.com/cars/audi ...
Cray's user avatar
  • 135
1 vote
1 answer
545 views

NGINX: localhost redirecting to _

nginx version/1.18.0 (Ubuntu) — Ubuntu 22.04.01 LTS x86_64 kernel 6.0.8 I've got a server (install specs above) that has multiple host names, is running nginx, and everything is working (including ...
Walt Stoneburner's user avatar
0 votes
1 answer
2k views

HaProxy redirect to internal URL

I have a configuration with two backend servers I need to redirect 301 to each server with an internal URL on HTTP. It's hard to use SSL because I can't install SSL on the Report Server in that ...
Dr.Fr05t's user avatar
1 vote
1 answer
175 views

How Can We Do 301 Redirect Of Over 200 Pages To Corresponding 200 Pages At New Location?

I need help and need it fast. We recently migrated a subdomain to integrate with the domain. Eg. https://blog.example.com to https://www.example.com/blog https://blog.example.com has a ton of traffic ...
user18571's user avatar
0 votes
1 answer
300 views

nginx: [warn] server name has suspicious symbols with long domain redirect

What is the best way in Nginx to redirect two Long domains URLS, I would like to configure a redirect between two domains like this: I'm sure this has been asked before, but I can't find a solution ...
Santosh Baruah's user avatar
0 votes
0 answers
383 views

Issue with Nginx Url Rewrite /Redirect

For new site config I tried NGINX rewriting for the blog plan and keep the paths the same, just redirect from 'www.' to 'blog.'. and plan for RSpace API and CME have been configured and the ALB. www....
santosh baruah's user avatar
0 votes
2 answers
49 views

route your blog from xyz.com/blog/ to abc.com/blog/

My WordPress website domain name was abc.com (let's say) now due to a new partnership agreement the domain name is changing to WordPress xyz.com (let's say). I tried this answer https://stackoverflow....
paul's user avatar
  • 103
0 votes
3 answers
883 views

Best way to do 301 redirects

Which is the best way to do 301 redirects (for whole domains and also for specific pages/directories)? Using Apache virtual blocks, .htaccess or other solutions? "Best" for me probably means ...
migueltic's user avatar
  • 113
0 votes
1 answer
920 views

Regex to remove certain patterns from urls

So i've tried this multiple times but to no avail. Basically, what I am trying to do is check if the URL has a certain language locale and remove it and do a 301 redirect to the parent url without the ...
user3321266's user avatar
0 votes
1 answer
189 views

Having trouble getting a regex to redirect traffic to work correctly

I'm trying to setup some 301 redirects on WPengine using regex and I'm having trouble getting things working. Old URL: https://www.website.com/abc/123 New URL: https://www.website.com/abc For pages ...
Windows Ninja's user avatar
0 votes
1 answer
794 views

Redirect all pages to non www and one page to www

I want to redirect all my internal pages (eg: example.com/about) to their non-www version but I want my homepage (https://example.com) to redirect to its www version (https://www.example.com). I ...
Excellent Exim House's user avatar
4 votes
4 answers
10k views

How can I redirect domain A to domain B without hosting, using only DNS records?

I want to redirect domain A (without hosting space) to domain B (301), but when I try https://domainA.com or https://www.domainA.com it ends with ERR_CONNECTION_REFUSED. Is it even possible to use ...
Patryk Chowratowicz 'Zszywacz''s user avatar
0 votes
2 answers
1k views

Nginx http to https redirects download empty file instead

Im trying to redirect my Laravel+vuejs+nuxtjs project from http to https but when I enter http://example.com or http://www.example.com an empty file being downloaded instead What have I done so far : ...
Pc Monk's user avatar
  • 31
0 votes
0 answers
120 views

How to not redirect if is from social media site with Nginx?

How do I not force a redirect if it's from a social media site like reddit,facebook & twitter? Currently my setting is set to redirect any direct access to image files but I don't want to redirect ...
TravelWhere's user avatar
0 votes
1 answer
536 views

301 Redirect old domain to new and use the old domain for emails

What I want to do: Part 1. Redirect old domain to new domain. Part 2. Use the old domain for mails My current setup: Both domains are set up with Google Load Balancer and using Google managed SSL. To ...
jollysea's user avatar
0 votes
1 answer
256 views

301 redirect for some pages and all other pages

I have two websites. Let's say siteA.com and siteB.com. Now I want to add 301 redirect to siteB.com. Some of pages of siteB.com need to be redirected to some specific pages on siteA.com All other ...
ashanrupasinghe's user avatar
0 votes
1 answer
178 views

https request on github.com subdomains return wrong 301 redirections to domain

First When executing curl -iv4 https://support.github.com/contact I am receiving 301 responses with location https://github.com/contact. Obviously when executing curl against the location returned ...
Bamboozilla's user avatar
1 vote
1 answer
162 views

Redirect French homepage (and only FR home page) to English home page

Using the .htaccess file, I would like to redirect www.example.com/fr/ to www.example.com/ but not other French pages that have the /fr/ root (e.g. www.example.com/fr/page-name) I've tried using ...
Samuel's user avatar
  • 13
2 votes
1 answer
433 views

nginx redirect or return single location

I am trying to get videos.mydomain.com/kickboxing to redirect to a YouTube link, as well as videos.mydomain.com/classes to redirect to a different YouTube link. (These are both unlisted playlists, and ...
jwir3's user avatar
  • 155
0 votes
1 answer
201 views

Nginx puts browser into a redirect loop when using multiple server blocks

I'm using Nginx to host a number of virtual hosts (or server blocks in Nginx nomenclature). These hosts all share the same domain with each assigned its own subdomain. One subdomain enters an endless ...
thran's user avatar
  • 31
0 votes
2 answers
2k views

Why nginx "return 301" and ”try_files“ fall into an infinite loop

my conf code: index index.html index.php; location / { if ($uri = '/a/') { return 301 https://example.com/a; } try_files $uri $uri/ =404; } If url is /a/, 301 to /a, then ...
nanxiaobei's user avatar
1 vote
0 answers
656 views

Nginx rewrite and return interfere with different location block

I have the following configuration in nginx for redirecting in a certain scenario. location /prefix-someurl { if (condition) { return 301 $scheme://$host/xyz.html; } proxy_pass ...
Syed Osama Maruf's user avatar
1 vote
1 answer
89 views

Ngnix redirect for multilevel subdirectories

I have URL like the following structure: xyz/asset.html abc/test.html xyz/abc/test.html xyz/abc/qwerty/test2.html I would like to redirect: xyz/asset.html to xyz/asset xyz/abc/test.html to xyz/abc/...
Minhaj's user avatar
  • 177
0 votes
0 answers
83 views

Extra trailing slash when re-directing www to non-www

This is my current configuration: server { if ($host = www.mywebsite.com) { return 301 https://mywebsite.com$request_uri; } # managed by Certbot if ($host = mywebsite.com) { ...
Dr.Kameleon's user avatar
4 votes
1 answer
3k views

Have nginx redirect everything to https except one directory

I need nginx to redirect all http URLs to https, with the exception a ".secret/" directory which should continue to be served as http. So, for example: http://example.com/a.html --> ...
scaramouche's user avatar
1 vote
1 answer
72 views

nginx - 301 redirect wrong URLs used on extern website

For some reason, some extern websites have links to my website subdomain.example.com looking something like this: <a href="https://subdomain.example.com/https://subdomain.example.com/index.php?...
Perrschy's user avatar
0 votes
0 answers
157 views

Preventing redirects for file serving in apache

I am working with a specific proprietary (and no longer properly supporter) http client, and it has an issue of giving up on trying to download files if an http server throws a 301. I am using ...
whuykvpp's user avatar

1
2 3 4 5
11