Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
78 votes
Accepted

Why can I update a file owned by root using sudo vi, but not append a line to it with sudo echo "Thing" >> file?

Sudo elevates the process it calls, it does not elevate any of the current shell's processing like redirection, globbing, etc. The file redirection >> /etc/httpd/conf.d/vhosts.conf is being ...
Zoredache's user avatar
  • 132k
45 votes
Accepted

How can I redirect an entire site to a single page?

If you are "shutting down a site" then you probably should not be "redirecting" the old site pages to a single page. An HTTP redirect sends a 301 response code, informing users and ...
MrWhite's user avatar
  • 13.1k
30 votes

Prevent port change on redirect in nginx

In my case, nginx listens to port 80 inside a docker container, but it's mapped to port 8080 (or any random port) outside the container. There is no reverse proxy in-between that can add proper ...
Luxian's user avatar
  • 441
9 votes
Accepted

Using iptables port redirection with docker

A possible modification to the iptables rules is to remove both and replace with: iptables -t nat -A PREROUTING -p tcp -m tcp -i eth0 --dport 80 -j REDIRECT --to-ports 8080 This will ensure that, ...
davidA's user avatar
  • 393
5 votes
Accepted

Using Apache RedirectPermanent to send all requests to a specific subfolder

Redirect is not the correct one to use for what you seek. Redirect redirects "all" and "appends that all" to the destination, but you want a final single destination, so.. use this instead: ...
Daniel Ferradal's user avatar
4 votes

How to quick and easy remove part of an URL in Nginx with HttpRewriteModule?

Depending where you define the rewrite directive you have two ways to implement it: A. In the server context server { ... rewrite ^/component(.*)$ $1 last; ... } B. In the location ...
Teocci's user avatar
  • 153
4 votes
Accepted

haproxy redirect custom http traffic to a custom https port

Either remove port from redirect or replace-value http-request replace-value Host (.*):7777 \1 http-request redirect location https://%[req.hdr(Host)]:9999%[capture.req.uri] if is7777 OR http-...
nuster cache server's user avatar
4 votes
Accepted

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

Redirects cannot be done with DNS only. However, some providers have HTTP redirect services that are configured via same interface as DNS. These support only HTTP. HTTPS support requires valid ...
Tero Kilkanen's user avatar
4 votes
Accepted

How do I redirect a specific URL/ROUTE/PATH/LOCATION to another?

If I understand your setup, you have some external domain, example.com, controlled by a 3rd party, with a website running on it, controlled by someone else. You want to allow access to that site ...
Aleks G's user avatar
  • 1,016
3 votes
Accepted

HTTP to HTTPS rewrite not working the first time

The variable HTTP_POST doesn't exist. You most probably meant HTTP_HOST: RewriteEngine on ReWriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L] Since this is a permanent redirect the response code ...
Gerald Schneider's user avatar
3 votes

.htaccess - redirect non www to www and retain subdomains from redirecting

RewriteCond %{HTTP_HOST} !^(.*)\.(.*)\. [NC] RewriteCond %{HTTPS}s ^on(s)| RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] This works for all domains, excluding any subdomains. have ...
Yusuke's user avatar
  • 31
3 votes
Accepted

hosting multiple websites on multiple servers with a single outside IP address

Exactly. You need one http endpoint that takes the requests and then forwards the requests to the appropiate server on the inside. This is the very definition of a reverse proxy. Note that this means ...
TomTom's user avatar
  • 52k
3 votes

How can I redirect an entire site to a single page?

Shouldn't this work? RewriteEngine On RewriteRule ^ index.html
Hagen von Eitzen's user avatar
3 votes

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

Another option is such as https://forwarddomain.net/ which (kindly) gives a free redirect service using only DNS records. An example below redirects from sub.example.com to othersite.com sub.example....
willnode's user avatar
  • 216
3 votes
Accepted

Why I cannot access iDRAC9 remotely?

I double checked my iDRAC network settings, the gateway was proper (192.168.1.254). I also searched for and verified that the iDRAC can ping the gateway (racadmin ping 192.168.1.254 when I logged into ...
Csaba Toth's user avatar
2 votes

Why do redirects from my subdomain end up on my primary domain?

When using both an F5 and apache mod_rewrite and/or mod_proxy, where should subdomain handling, redirection, and/or SSL configurations be managed? As long as you decide to do so in one single ...
HBruijn's user avatar
  • 80.6k
2 votes

How do I remove the www from my domain URL

This can be achieved by Rewrite Valve, it's pretty similar to mod_rewrite in httpd : 1- Include rewrite valve in your global context file context.xml or your host context server.xml , I recommend it ...
Reda Salih's user avatar
2 votes

I'm getting Permission Denied when redirecting output from CMD to a text file using the logitech_dfu tool

Can you check if you can create a file through Windows (File)Explorer in c:\temp without getting a so called UAC prompt?
discondor's user avatar
  • 139
2 votes

I'm getting Permission Denied when redirecting output from CMD to a text file using the logitech_dfu tool

Unless this is a very old machine you're running on, the "TEMP" directory isn't where you think it is; not any more. Try using the %TEMP% environment variable instead. Logitech_dfu --output "%TEMP%...
Phill  W.'s user avatar
  • 1,511
2 votes
Accepted

Redirect from one domain name to another for the same website with IIS

You can use URL rewrite module <rule name="CanonicalHostNameRule" patternSyntax="ECMAScript" stopProcessing="true"> <match url="^(.*)$" /> ...
Omar El Sergany's user avatar
2 votes

How can I redirect an entire site to a single page?

The reason http://www.example.com/ is working and https://www.example.com/doesnotexist.html isn't is because your rewrite condition explicitly disables the rewriting if the client is accessing the ...
Jose Fernando Lopez Fernandez's user avatar
2 votes

Why I cannot access iDRAC9 remotely?

A solution is to use the IP address instead of the FQDN. Then it does work.
Wichard Hartes's user avatar
1 vote

How to set index.html to redirect wget query to an other page/file?

<!DOCTYPE html> <head> <meta http-equiv="refresh" content="0;URL=pubkey.asc"> </head> <body> </body> </html> Combined with wget -r http://example.com ...
user993553's user avatar
1 vote
Accepted

Need help on NGINX full URL redirection rewrite rule

Judging by your Apache rewrite rule, you're trying to rewrite the host portion for any request. A common idiom in to achieve this with NGINX is to use server blocks and return. server { listen ...
Joshua Griffiths's user avatar
1 vote

Why my https://MY_SITE.COM always redirect to the wrong server?

You don't have redirect on port 443. You should remove lemeilleurducbd.com from listen directive in first server section and add additional server section for HTTPS redirect: server { ...
Alexander Tolkachev's user avatar
1 vote

IIS URL Rewrite: Match subdomain and redirect to HTTPS

Your "Match URL" pattern is where you want to define subdomain.company.com. Your "Conditions" pattern should be off, because you want to redirect when {HTTPS} is off. Also, if this is a permanent ...
sippybear's user avatar
  • 3,277
1 vote
Accepted

redirect www.subdomain.domain.com to subdomain.domain.com

Please be aware that a wildcard TLS certificate *.example.com will not be accepted as valid for *.*.example.com. The * in a wildcard certificate should match 1 or more non-dot characters. In other ...
HBruijn's user avatar
  • 80.6k
1 vote
Accepted

DNS alias to external subdomain

Option 1: CNAME www.theother.ch to point to mysub.maindomain.ch. People will go to www.theother.ch in their web browser, the web browser will always show www.theother.ch in the address bar, but will ...
Wesley's user avatar
  • 32.9k
1 vote
Accepted

Redirect traffic from one IP address

Your FORWARD rules allow VM initiated traffic, outgoing and reply, with these rules: -A FORWARD -d 192.168.122.0/24 -o virbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT #reply traffic to ...
A.B's user avatar
  • 12.9k
1 vote

Redirect one interface

The psuedo interface 'eth0:1' is not a real interface. It is just a label that is associated with the address because the older tools were kinda stupid and didn't permit more then one IP per ...
Zoredache's user avatar
  • 132k

Only top scored, non community-wiki answers of a minimum length are eligible