Tag Info

Hot answers tagged

3

Use a negation RewriteCond %{HTTP_HOST} !^www\.domain\.com$ RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L]


2

nginx always requires the leading slash in the URI part of the rewrite, while Apache doesn't want it. Without seeing the complete configuration, this is just a guess what the problem might be. Try this: rewrite ^/([^/]*)/([^/]*)\.html$ /?cmm=$1&page=$2 last;


2

Try ProxyPass / http://localhost:8090/ReportServer nocanon ProxyPassReverse / http://localhost:8090/ReportServer


1

Sounds like your jail lacks permissions for SysV IPC. Try to set sysvipc_allow=1 in your jail settings or pass it with jail command.


1

The Proxy http://localhost:8080 is meant only to apply permissions and other apache rules (restricting to some client IP, asking for authentication, etc), not for configuring the proxy itself. The equivalent proxy without mod_rewrite would look like this: ProxyPass / http://localhost:8080 Or if you need to apply any kind of restriction: <Proxy ...


1

This should do the trick. We include the https redirect in a location block, and then we define additional empty location blocks for the locations we do not want to redirect. nginx will match the more specific location blocks first, so it won't match the redirect block. return 301 is a bit faster method for simple redirects like here. location / { if ...


1

The RewriteRule has some not needed stuff, which could cause this behavior. Try this instead: RewriteRule ^/assets/img/newsletter/(.+)$ https://s3.amazonaws.com/mybucket/newsletters/legacy/$1 [R=301,L] Here I use the "one-or-more" quantifier to regex, so that $1 cannot be empty at any point.


1

Since you capture the part of the URI you are interested in already in the first RewriteCond block, you don't have to capture it again to do the RewriteRule, and since both of your RewriteConds are met, there's no need to parse the URI a third time, so a simple caret would do it. # Is it in the newsletters directory RewriteCond %{REQUEST_URI} ...


1

rewrite is a server internal operation; the user doesn't see the result (unless you expose it manually in some way). You could try the Content-Disposition header; but the best way is to fix your URLs (i.e. have .../foo.pdf from the beginning). You could use redirect rules for the migration.


1

An Apache2 snippet from this Q&A has been modified as follows: Configuration <VirtualHost IP:80> RewriteEngine on RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} !/somedir RewriteCond %{REQUEST_URI} !/someotherdir/somefile.php RewriteRule ^(.*)$ http://www.domain.ca/department$1 [R=301,L] </VirtualHost> Test results ...



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