Linked Questions

438
votes
8answers
155k views

How does IPv4 Subnetting Work?

This is a Canonical Question about IPv4 Subnets. Related: How does IPv6 subnetting work and how does it differ from IPv4 subnetting? How does Subnetting Work, and How do you do it by ...
20
votes
6answers
15k views

Redirect to SSL only if browser supports SNI

I have Apache 2.2 with mod_ssl and a bunch of sites in HTTPS on the same IP/port with VirtualHosting, so client must support SNI to connect to those virtual hosts. I would like to configure my server ...
17
votes
1answer
19k views

How to add exceptions to apache reverse proxy rules [duplicate]

I am trying to set a Apache reverse proxy so that requests get proxyed to another application running on 8080. However, I want some directories to be directly served rather than forwarded to proxy. ...
7
votes
5answers
86k views

How do I use .htaccess to always redirect from HTTP to HTTPS? [duplicate]

There's a few similar questions which I tried to work out the answer from, but so far I have been unsuccessful. Please advise how I can always redirect http to https (and also remove www. from the ...
6
votes
3answers
20k views

How do I make RewriteCond %{HTTP_COOKIE} match a cookie value exactly? [duplicate]

How do I make my rule match an exact value of a cookie? I've tried: RewriteCond %{HTTP_COOKIE} ^its=me$ [NC] RewriteCond %{HTTP_COOKIE} its=^me$ [NC] RewriteCond %{HTTP_COOKIE} its="me" [NC] ...
5
votes
2answers
7k views

Redirecting from http to https in Apache

This is a canonical question about redirecting from http to https in Apache Related: Everything You Ever Wanted to Know About Mod_Rewrite Rules but Were Afraid to Ask I have an ...
4
votes
1answer
244 views

Redirect automatically to subdirectory and also remove www [duplicate]

I want to do 2 things : redirect http://www.example.com (with www) to http://example.com/fr (without www, AND subdirectory) Of course, I also want http://example.com to redirect to http://example.com/...
3
votes
2answers
13k views

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

So, on my main domain 'domain.com' I created several subdomains from cPanel, like 'sub1.domain.com' and 'sub2.domain.com'. Their real location on server is in 'domain.com/sub1' and 'domain.com/sub2'. ...
3
votes
1answer
8k views

Can HAProxy be used to rewrite for pretty URLs?

Can HAProxy rewrite a URI from "domain.com/cool/url" to "domain.com/index.php/cool/url" as it passes a request to the Web server? Thanks.
3
votes
2answers
852 views

HTTP / Redirecting to a URI on the server

I want to redirect a certain URI to a new one on the same server. This can be done by sending a response with a 3xx code, and a 'Location' header. Now the HTTP/1.1 standard dictates that this should ...
3
votes
1answer
3k views

One Apache Redirect, Multiple Exceptions

I'm going to try and explain the situation I'm in so the problem is a little more understandable first I think. I'm basically tryng to redirect an old website to a new one using: RedirectMatch ...
3
votes
1answer
358 views

RewriteCond: check is %{HTTP_REFERER} include or equals %{REQUEST_URI}

Is there a way to check using RewriteCond whether the Referer includes the requested URI or... RewriteCond %{HTTP_REFERER} == 'host.com/' + %{REQUEST_URI} ... ? I need to catch whether the surfer ...
3
votes
2answers
4k views

How should I separate public and private pages on my webserver?

What I want to achieve I have public and private sites on my webserver, and I would like to somehow separate them, but I want this separation to be invisible. So for example DocumentRoot is /var/www ...
3
votes
1answer
2k views

Is it possible to serve different DocumentRoot from Virtual Host in Apache conf depending on IP of the visitor?

I just wonder if it's possible to define several DocumentRoots for single VirtualHost in httpd.conf and serve them out depending on IP of the visitor?
3
votes
1answer
2k views

Apache Rewrite Rule not Matching Colon (:)

I'm having trouble writing a rule that will rewrite an address like http://localhost/hello:world to http://localhost/hello/world.html My RewriteRule in httpd.conf is as follows: <Directory "D:/...

15 30 50 per page