Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

-2
votes
2answers
20 views

How can I redirect all web requests to a specific subdomain on Nginx?

I have a website that I only want to serve requests at: abc.mywebsite.com I want any requests to: www.mywebsite.com mywebsite.com <anything that is not abc>.mywebsite.com to be directed to ...
0
votes
1answer
49 views

SSL Certbot in a domain with 301 redirect and nginx [closed]

I have one server at home working with a dynamic domain (mydomain.ddns.net) through my OpenWRT router. Now I want to host a web and I have bought a domain (www.mynewdomain.com) in GoDaddy and I have ...
2
votes
1answer
36 views

nginx try_files issuing http redirect beind load balancer; need https [duplicate]

My nginx instance is behind a SSL terminated load balancer, and I want all urls to hit https endpoints, which means http to be redirected to https. All is well when urls have a trailing slash. They ...
-1
votes
0answers
10 views

Htaccess wildcard redirect to another folder [duplicate]

I'm looking for an example to create a htaccess to 301 redirect wildcard urls to one folder and if there is no wildcard url to another folder. Example: If hits only Domain.com ---> Redirects to: ...
0
votes
1answer
22 views

Why is IIS 8 redirecting all HTTP requests to HTTPS?

I have a fresh install of Windows Server 2012 R2 with IIS 8 installed and all fully patched. I have created a new web site with a single page called home.htm and the site has an HTTP binding on port ...
0
votes
0answers
16 views

Folder 301 redirection [duplicate]

i can't redirect correctly an url path in htaccess Problem: https://www.example.com/folder1/folder2/folder3/ needs to rewrite in: https://www.example.com/folder1/FOLDER/folder3/ I tried many ways ...
2
votes
3answers
1k views

How to redirect specific pages in htaccess, and all other redirect to the homepage?

How do I 301 specific pages to a new domain URI, and then all the rest of the pages, just send to the homepage? Example -- Specific pages I want to move -- Redirect 301 /contact.htm https://...
1
vote
1answer
1k views

NGINX: Check if SSL (HTTPS) is available, if not, redirect to HTTP

The current config is: server { listen 80 default_server; listen [::]:80 default_server; listen 443 ssl default_server; listen [::]:443 ssl default_server; listen 192.168.0.5:80 default_server;...
6
votes
4answers
15k views

Is an SSL Cert needed for redirects?

We currently have a website set to redirect to a new address (our client changed domain names, but wants the old domain to send people to the new site) in IIS 8.5 using permanant redirects found in ...
13
votes
9answers
38k views

Restrict direct IP access to website

I want to restrict direct IP access to my website. I found several solutions involving .htaccess but none work. I've also found one solution via apache virtual hosts config which was working fine up ...
0
votes
0answers
15 views

301 redirect configuration in apache2

I have an apache2 running on an Odroid XU4, and I've managed to configure port redirects, Dynamic DNS and HTTPS using LetsEncrypt. Right now I'm using a DDNS domain from a free service (xxx.ddnss.de),...
0
votes
2answers
1k views

Nginx proxy cache 301 redirects but ignore querystring

We have a lot of ad-based traffic that pass various query string params on the URL, but these do not affect the content/output of the pages. I currently have the following nginx proxy cache ...
0
votes
1answer
1k views

nginx: Multiple cross-domain 301 redirects with different page addresses

I'm moving my old site over to a new domain, and with that new domain comes new naming conventions. I'm trying to figure out what would be the simplest way of accomplishing the following for roughly 8 ...
1
vote
0answers
16 views

AWS S3 + Route53: Always redirect to www prefixed domain [duplicate]

I have a domain: example.com. I've created an A record for www.example.com with an alias targeting the load balancer’s DNS; this works just fine for www.example.com. Now, I want to redirect all ...
0
votes
1answer
49 views

Redirecting HTTPS

We built a site for a client to advertise a new block of apartments they had built. The apartments have now all been sold so we have been asked to forward the domain to another domain until there is ...
0
votes
1answer
30 views

.htaccess throw 404 and then 301 on nonexistent path

Currently I have this set up in my .httaccess RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !\.(php|html|txt|js|css|png|jpe?g|gif|svg|woff|ico|csv|xml|pdf|gzip) RewriteCond %{...
0
votes
1answer
2k views

Apache: Redirect everything from www to non-www using https only (including HSTS)

My goal Everything results in https://mydomain.tld (non-www and with TLS) and HSTS works correct. I am using the certificates from LE (Let's Encrypt) and so I used their wizard to make my website ...
1
vote
1answer
59 views

Virtual hosts on Apache not applying 301 redirect

I have a Ubuntu 18.04 server on an Amazon EC2 instance running Apache 2, with an SSL certificate installed, which I use exclusively to host virtual hosts for .tld variations of the policymakr.com ...
0
votes
0answers
45 views

Nginx redirect multiple query string urls

I want to redirect some URL to another folder on the same website. Each URL have query string so simple 301 return is not working. Example of redirect I want. example.com/th/?n=abc 301 to example....
3
votes
1answer
2k views

How can Nginx force browsers to disable or flush the redirect cache?

We have the following secure site. If the user opens http://name.tld, he should be redirected to https://name.tld. We initially messed up the order of the domains in the secure site, so http://name....
0
votes
0answers
62 views

URL redirection and ACL conditions in Haproxy

I would like to check and compare the maxconn and conn_cur in haproxy. If the conn_cur value greater than maxconn, the url needs to be redirected. URL redirection is working, but the maxconn & ...
2
votes
1answer
6k views

Haproxy 301 URL redirect on query string condition

Using Haproxy 1.5.12 running on Ubuntu 12.04 My website gets a lot of requests like this one: http://www.example.com/foo/bar/mypage.php?gallery=&position=3 the correct URL should be: http://...
1
vote
1answer
60 views

How to debug big redirect chain in nginx. Unexpected redirect

I have a task to make a large site migration now. And i have a large number of redirects in config. But I cannot understand why one redirect causing second redirect in chain. Even if any other ...
0
votes
1answer
61 views

nginx server configuration to redirect all requests to ssl without subdomain

I want to redirect all requests to example.org. I created a configuration file as below. I can redirect the requests from : http anything.example.org to https example.org https anything.example.org ...
0
votes
0answers
85 views

Nginx Redirect Loop in a Letsencrypt Docker with Multiple Sites

I am getting a "too many redirect error" when I try to go to my own websites. Those websites are hosted on my server with Nginx inside a Letsencrypt Docker(Docker Hub: https://hub.docker.com/r/...
0
votes
1answer
33 views

NGINX: Cannot config nginx to handle redirect from HTTP to HTTPS redirect not working

I have try to config nginx: /etc/nginx/nginx.conf server { listen 80 default_server; listen [::]:80 default_server; server_name 10.0.0.10; #This is my private IP return 301 https://$...
4
votes
5answers
4k views

How to redirect https://domain.com to https://www.domain.com using IIS?

I have a 301 set up which redirects http://domain.com to http://www.domain.com (http://www.domain.com$S$Q) but if I browse to https://domain.com I get an SSL error (as it expects www.domain.com). Is ...
0
votes
0answers
19 views

Apache HSTS with non-www to www 301 redirect

Just been setting up HSTS on an Apache vHost (it is a virtualmin box) and have that working, however I am experiencing strange behavior when trying to force a call to https www rather than it ...
0
votes
1answer
100 views

SSL Certificate, Redirect, No-www done right (apache)?

MY GOAL I would like to make a website accessible only via SSL (encrypted) and with many domains redirecting to only one master domain (no duplicate content) and all www variants should be no-www. ...
14
votes
2answers
27k views

Best way to redirect all HTTP to HTTPS in IIS

We want ALL sites on our webserver (IIS 10) to enforce SSL (ie redirect HTTP to HTTPS). We are currently 'Requiring SSL' on each site and setting up a 403 error handler to perform a 302 redirect to ...
5
votes
1answer
34k views

Getting “Too many redirects” error with nginx rewrite rule

I am trying to rewrite the domain url that targets my site such that all domain names are rewritten to www.example.com and have the following config: mysite block server { listen ...
1
vote
0answers
73 views

Removing nginx server_name results in too many redirects

I'm trying to test out a new website before replacing the original one, since I don't want to impact users. I have an existing website at say example.com and am working on a separate WordPress site ...
0
votes
1answer
203 views

NGINX SSL “ERR_TOO_MANY_REDIRECTS”

I have website build with django and nginx. After adding Let's Encrypt SSL certificat using Certbot I get the error : ERR_TOO_MANY_REDIRECTS. Please find the below nginx configuration : server { ...
1
vote
1answer
199 views

Mapping Old to new URL is not working in Nginx

I am moving my old Url's to the new one (it is more than 50) so I have placed the URLs in a file but the redirection is not happening. map_hash_max_size 262144; map_hash_bucket_size 262144; map $uri ...
1
vote
1answer
371 views

Editable URL Rewrite Map for CloudFront/S3 Website using Lambda@Edge

I'm migrating a static website from IIS to Amazon S3, using CloudFront for https. The old site used the URL Rewrite module and had 301 redirect maps with over 200 entries. Here is an example: example....
0
votes
1answer
83 views

Redirect with space character for file download

I have this in the .htaccess file: Redirect 301 /product-installer https://download.testsite.com/installers/My%20Product%20v3.0.0.0.exe It's working correctly of Firefox as when you click the URL ...
1
vote
1answer
267 views

301 Redirect all child pages to parent page with the exception of a few child pages to other pages throughout the site

How would I go about 301 Redirecting all child pages to the parent page with the exception of a few child pages 301 Redirected to other specific pages throughout my site. Below works for redirecting ...
0
votes
1answer
68 views

Nginx HTTPS redirect loop with multiple domains

I know that there are other questions with similar topics, but I can't find a solution anywhere that solves my specific problem. The difference here is multiple domains with different sites. I have ...
1
vote
1answer
234 views

redirect dynamic url to subdomain

I am trying to redirect the URL to the corresponding subdomain. For example: example.com/account/user example.com/account/user2 to user.example.com user2.example.com I have tried: Redirect /...
4
votes
4answers
13k views

How to redirect non-www to www without hardcoding using .htaccess?

RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] ...causes a perfect, non-hardcoding 301 redirect from "www to non-www", ...
0
votes
2answers
392 views

Unable to remove 301 redirect for wordpress wp-admin on nginx

Unable to remove 301 redirect for wordpress wp-admin on nginx. The homepage seems fine I’ve tried almost everything Disabling plugins by renaming the plugin directory Removing the ...
1
vote
1answer
75 views

.htaccess 301 redirect remove [] from the URL

I want to remove '[' and ']' from the URLs and redirect to correct link. Here is a sample URL: /forums/garage-150/cool-cars-sightings-[archived]-7610/index127.html Needs to be redirected to: /...
1
vote
1answer
265 views

Apache Redirect to /index.php - How to handle direct requests for /index.php

I'm not 100% sure if this should be on server fault or stack overflow, though I'm leaning towards server fault. Most PHP frameworks utilize Apache redirects to funnel all request to /index.php and ...
1
vote
2answers
3k views

Trying to redirect with and without trailing slash

I have moved a blog to a subdomain and on the subdomain all the categories have changed so I want to do a list of 301 re-directs from old domain to subdomain (different hosting). The problem I am ...
0
votes
1answer
128 views

How to redirect all requests except when there's an exact string match

Requirement- I want to redirect all requests that end with /abcd to /products/abcd This should match all urls such as these- /collection/abcd /collections/all/abcd /hello/world/abcd This is what i'...
0
votes
1answer
57 views

Apache: Is the password protection in a .htaccess file always processed first?

Last week I did a relaunch on a website and today I have realized that the staging subdomain got indexed by Google. I want to avoid this mistake in the future and track down the error source. I ...
1
vote
0answers
87 views

301 redirect on IIS with optional query string

I have a working 301 redirect setup for languages that looks like this: <rule name="mygreatrule" stopProcessing="true"> <match url="^productname" /> <conditions logicalGrouping=...
1
vote
1answer
2k views

nginx redirect loop with proxy_pass and $http + CloudFlare

My nginx configuration works great until I add a redirect that forces HTTPS. The working config before the redirect is is: server { listen 80; listen 443 default_server ssl; server_name my-...
0
votes
0answers
71 views

Linode Longview Apache https Redirect

I have setup Linodes longview (which is used to view your servers information from the linode dashboard). All is working apart from the Apache tab, which gives the following error: Unable to access ...
0
votes
2answers
89 views

How to certify a domain that's used only for redirections and has no hosting?

I migrated a site from oldsite.example to newsite.example. HTTPS was enforced all over, so most incoming links to oldsite are going to https://www.oldsite.example. My oldsite.example domain used to ...