New answers tagged

0

Whilst neither of the rules you've posted are strictly correct, they should both perform the required redirect. If you have other directives in your .htaccess file then the most likely cause is that they are in the wrong order and you have a conflict. These redirects will need to go near the top of the .htaccess file, before any existing mod_rewrite ...


0

For posterity, I discovered mod_macro. It gets rid of a lot of duplication by letting me write a Macro template for the blocks above and reducing my actual VirtualHost files to a single Use line with variables. Look for examples in the Apache docs.


3

In your config first server block is the default_server which will be used for all requests that don't match a more specific server. Rather than return 301 https://www.$host$request_uri; in the default_server don't use the Host header from the request as a parameter to generate the redirect, as that can become all kinds of incorrect things, instead use ...


0

Here are two solutions to your problem. 1. Using virtual hosts You probably have a VirtualHost that points to your website. Edit it this way: <VirtualHost *:80> DocumentRoot /path/to/your/directory/home # add /home at the end ServerName example.com <Directory /path/to/your/directory> Options Indexes FollowSymLinks ...


2

Right now my .htaccess looks like this: If that is all you have in your .htaccess file then you can include some exceptions for the URLs you want to exclude before your existing rule that redirects. For example: # Prevent further processing if requesting a URL of the form # example.com/tt.php?xxx (where xxx can be any number) RewriteCond %{QUERY_STRING} ^\...


0

You need to configure nginx as reverse proxy. Reverse proxy is proxy server (middleman) which sits in front of web server (in your case web UI server) and intercepts and forwards client traffic to it. Basic nginx configuration for reverse proxy (just replace your default server { } block with this one) server { listen 80; listen [::]:80; ...


1

Not sure if Nginx supports \b, but you only need to use / (without a backslash). You do not need to specify https://example.com in the replacement URI if the value remains unchanged. See this document for details. In the example in your question, two values are captured ($1 and $2), but only one is used in the replacement URI. Try: rewrite "^/(19|[2-9][0-...


3

"HTTPS Only" means if someone goes to http://foo.cloudfront.net/, they'll get an error. "Redirect all HTTP requests to HTTPS" means they'll get redirected from http://foo.cloudfront.net/ to https://foo.cloudfront.net/. "HTTPS Only" is fine for a CloudFront URL your users wouldn't type (like for an images CDN, or proxied in front of an API), but if you're ...


Top 50 recent answers are included