Tag Info

New answers tagged

0

I'm not positive, but think your problem is right at the beginning of your location block: location /cdn I think if you try something like this: location ^/cdn/(.*) you'll get the desired effect.


-1

You can do it with WordPress rewrite API that can convert URLs from somewhat programmatically well-located to users. Read this article can be helpful to rewrite rule for custom parameter - http://clivern.com/how-to-add-custom-rewrite-rules-in-wordpress/


2

You should use another server block for the redirect. server { server_name *.domain.tld; listen 100.10.10.1; location /personal { rewrite ^ http://domain.tld/personal permanent; } } And then you should remove the location block from the other server block, and remove *.domain.tld from the server_name directive.


1

RewriteRule ^(cp_contactformtoemail_captcha.*image.jpg) /INDEX.PHP/$1


0

For a site using plain vanilla cPanel-based shared hosting (Apache 2.2), I solved what appears to be the same problem by adding a file named "401.shtml" to the document root (public_html). The mere existence of the file, without even an ErrorDocument 401 directive in the .htaccess, solved the problem.


-1

you can use 2 ssl certs on the same server with one IP but they must use another port. Multi-name certs are quite costly. URL rewrite can be used to hide the port from the client.


2

Unfortunately the only reasonable solution is to fix the application so that it generates correct URLs. All other solutions will cause subtle issues.


0

Something like location / { set $proxy_port 8080; if ($uri ~ "^/service/([0-9]+)/.*$") { set $proxy_port $1; rewrite ^/service/[0-9]+/(.*)$ /$1 break; } proxy_pass http://127.0.0.1:$proxy_port; } at least it works for me on Nginx 1.6.2


0

Seems like your problem lies in the inability to resolve _, not in nginx config file. Make your own TLD zone for _, or at least add a record in /etc/hosts.


0

Set a nginx block to listen on port 80 to redirect everything to https. Put the usual configuratioons under the 443 block. server { listen 80; server_name _; return 301 https://$server_name$request_uri; } server { listen 443 ssl; server_name _; [....] }


1

You may have better luck with this. server { listen 80 default_server; location / { rewrite ^/(.*)$ http://example.org/$1?site=$host permanent; } }


3

In nginx, you won't use a rewrite for this at all. You would use try_files instead. For example: try_files $uri $uri/ /puppy/index.php; Or, more likely, try_files along with a named location to handle PHP scripts. This isn't something that should be done in isolation; it is an integral part of the entire server block and you should not consider it ...



Top 50 recent answers are included