w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Nginx 'rewrite or internal redirection cycle while internally redirecting' resulting in 500
Have you tried something like this? (specific to Magento maybe) server { listen 80 default; ssl off; root /var/www/magento; server_name mydomain.com.au; location / { index index.html index.php; try_files $uri $uri/ @handler; expires 30d; } location ^~ /app/ { deny all; } location ^~ /includes/ { deny all; } location ^~ /lib/ { deny all; } location ^~ /media/downloadable/ { deny all; } location ^~ /pkginfo/ { deny all; } location ^~ /report/config.xml { deny all; } location ^~ /var/ { deny all; } location /var/export/ { ## Allow admins only to view export folder auth_basic "Restricted"; ## Message shown in login window a

Categories : Wordpress

nGinx rewrite if previous rewrite did not find any file
I know you seem to have figured it out, but i would like to suggest a simpler answer, might need some fixing but you'll get the idea, Note: I haven't tested those. location ~ /(?:images|stylsheets|scripts) rewrite ^(.*)$ /assets/$1; } or maybe location ~ /(?:images|stylesheets|scripts) rewrite ^ /assets$request_uri; }

Categories : Nginx

Internal redirection in Padrino
First of, you can put logic behind the showing data into separate function that you can call from both GET and PUT routes. If you really want to pass processing to a different route, you can do it with rack's call method: put '/foo' do # putting related stuff call env.merge('REQUEST_METHOD' => 'GET') end

Categories : Ruby

I'm trying to rewrite a sef url into a plain url using nginx
you probably need to add a break at the end of the line rewrite ^/tools/app/(.*)$ /tools/app?action=$1 break;

Categories : PHP

Rewrite old image url with nginx
If you want to use rewrite you need to use a full path to the new location rewrite ^/assets/avatar/avatar.png http://example.com/assets/avatar/newavatar.png permanent; A better way though is using a return location /assets/avatar/avatar.png { return 301 $scheme://example.com/assets/avatar/newavatar.png; } If you want to just rewrite, you need to change permanent to last or break

Categories : Nginx

Nginx rewrite in subfolder
Try this, I changed my answer to try to imitate the same behaviour you are using in your rewrite. location ~ /blog(.*) { index index.php; try_files $uri /blog/index.php?$1&$args; }

Categories : Wordpress

Rewrite rule fir NGINX
this one is pretty simple, you just want to tell nginx to ignore the word blog ( and I'll assume it has to be followed with the word category1 ) rewrite ^/category1/(.*) /blog/category1/$1 last; # | | | | | | # [1] [2] [3] [4] [5] [6] [1]: URL begins with [2]: category1 [3]: capture all that follows [4]: add blog [5]: add the rest of the URL ( that we captured in [3] ) [6]: stop the rewrite and process the new URL and any other matching rewrites.

Categories : Nginx

301 Rewrite Permanent Redirect in Nginx
In nginx change server_name from site1 to site2 and then create a new site1 block server { listen 80; server_name site1.com; location / { return 301 $scheme://site2.com$request_uri; } }

Categories : Nginx

nginx rewrite secure link
I'd say change the /files block, because right now it's logical to return 403, because you just deny all. location /files/ { internal; } This would return 404 for non authorized instead of 403, don't know if that works for you.

Categories : Nginx

Apache mod_rewrite to NginX rewrite help please
This mostly should do the trick, the problem would be on what exactly u want to be passed to index.php server { server_name example.com; root /path/to/www; location / { try_files $uri $uri/ /index.php$request_uri } } server { server_name www.example.com; return 301 example.com; }

Categories : Nginx

Nginx rewrite throws out 404 Not Found
why not try adding a more specific location block location ~ /nbhy/?$ { rewrite ^ /nbhy/authentify/signin last; } or you could remove the regex but it would match longer urls like /nbhy/one/two location /nbhy { rewrite ^ /nbhy/authentify/signin last; }

Categories : Nginx

Nginx rewrite rule guide
Rewriting on nginx is quite the same than on Apache :) The syntax varies. When Apache uses RewriteRule, nginx uses rewrite. May I suggest you this reference http://wiki.nginx.org/HttpRewriteModule ? Check 2.4 and 2.5 for rewriting-specific documentation. You'll find information about the rewrite syntax, and rewriting options. There is a quick example from above, if you just need the basic syntax : rewrite ^(/download/.*)/media/(.*)..*$ $1/mp3/$2.mp3 break; By the way, if you want to work from examples, you can transform your Apache .htaccess file into a piece of nginx configuration, using this tool : http://winginx.com/htaccess

Categories : Nginx

Nginx rewrite rules with try_files
If you need just to rewrite that one css.css file to wp-admin/admin-post.php?action=thesis_do_css then try this: if ($request_filename ~ wp-content/thesis/skins/classic-r/css.css ) { rewrite ^ http://mydomain.com/wp-admin/admin-post.php?action=thesis_do_css? permanent; } That should be within your server{ block. Make sure to change mydomain.com to your actual domain, of course. I hope that helps.

Categories : Htaccess

nginx rewrite module not working?
You seem to have mixed different bits from different how-to's, without understanding them. Observe: rewrite ^(.*)$ index.php?/$1 last; #question mark, typo? location ~ .php$ # matches end of request_uri fastcgi_split_path_info ^(.+.php)(/.+)$; # matches .php followed by a slash For the third statement to match, .php is never at end of request_uri, so this statement will never match in this location. Remove the question mark from the first statement, remove the dollar sign from the location. Then add: fastcgi_param SCRIPT_FILENAME $document_root$ fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_split_pathinfo; to the location block. Try to understand from the documentation and try to further restrict the location block.

Categories : Nginx

Magento, how to rewrite index.php in url ? (nginx)
Your problem is probably at the @handler location, did you write it on your own or was it on the magento docs ? I'd suggest trying rewrite ^ /index.php$request_uri;

Categories : PHP

nginx rewrite code for ZenPHOTO 1.4.5
Right now, i am using the following rules it works for me. location ~ .(gif|jpg|png) { try_files $uri @img_proxy; } location @img_proxy { rewrite ^(.*)$ /index.php?$1; } location / { try_files $uri $uri/ /index.php?$uri; } Note: It works for latest ZenPHOTO 1.4.5 version and i didn't check old versions.

Categories : Nginx

NGINX rewrite rule with exclusions
Well i think one rule could handle all of this, but I'll assume a couple of things and you need to confirm it. for root location there's an index.php for /images and /file.html I'll assume that those files exist with the exact path and serve them, I'll explain more after i write the rules server { server_name mydomain.com; # maybe www.mydomain.com too index index.php; # or index.html, depending on ur app structure location ~ /(.*) { try_files $uri $uri/ /index.html?profile=$1; } } /images/image.png and file.php/file.html will all be matched by the first rule $uri, root will serve index.php (not very sure though) and when all fails (like your /something URL, it will try the /index.html?profile=something ps: I would have used $request_uri instead of $1 but it inc

Categories : Regex

url rewrite internal server error
You're missing a space between the left and right hand of the rule. RewriteRule ^commenting/([0-9]+)/?$ /commenting.php?id=$1 You may as well need to enable the RewriteEngine and Options resulting on the following: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteRule ^commenting/([0-9]+)/?$ /commenting.php?id=$1 If you're still getting 500 after this try placing the above rule between these tags <IfModule mod_rewrite.c>...</IfModule> like this: <IfModule mod_rewrite.c> Options +FollowSymLinks -MultiViews RewriteEngine On RewriteRule ^commenting/([0-9]+)/?$ /commenting.php?id=$1 </IfModule> The above basically means to execute the rules only if the module that makes it work is available.

Categories : Apache

Nginx rewrite some matching rules are not working
Actually i don't like neither of the methods, it might be working but it's not really the best way to write it, so lets try something different. location *~ ^/(contact|privacy|terms|faq)/?$ { try_files $uri $uri/ /index.php?v=$1; } location *~ ^/(twitter|facebook|login)/?$ { try_files $uri $uri/ /index.php?v2=$1; } location / { try_files $uri $uri/ /index.php; } o and I never heard of a last; break; it's probably working only because nginx is ignoring the last part of it, it's either a last or a break,

Categories : PHP

Moodle 2.3 with Nginx vs slash argument rewrite
(Answered by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments ) The OP wrote: I solved this by putting rewrite directive in {server} not in {location} section. In my scenario moodle is installed under subfolder: example.com/moodle. server { server_name example.com www.example.com; rewrite ^/moodle/(.*.php)(/)(.*)$ /moodle/$1?file=/$3 last; location ^~ /moodle { try_files $uri $uri/ /index.php?q=$request_uri; index index.php index.html index.htm; location ~ .php$ { fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_pass 127.0.0.1:9090; include includes/fastcgi_params.conf; } } }

Categories : Nginx

Rewrite root address to a subdirectory in nginx
I found help in the nginx irc chat. Basically what I needed to do was use a return instead of rewrite. So I changed this: location = / { rewrite "^$" /wiki/Main_Page; } to this: location = / { return 301 http://www.example.com/wiki/Main_Page; }

Categories : Nginx

change nginx rewrite regex condition
I am not at home so i could not test it right now but something like this should work: rewrite ^/answer/1/(www.)*(.)(.+)/(.+)$ /answer/1/new.html break; rewrite ^/answer/1/(www.)*(.)(.+)$ /answer/1/$2.html last; Let me explain: as stated in the nginx docs (here) break stops processing the current set of ngx_http_rewrite_module directives; so if a request match the first rewrite rule (that is similar to your rewrite but ends with the /(.+) directive. This means that will match every request that was already matching but if and only if it is followed by 1 or more character after the slash. Beware of this because this means that the following url: mydomain.co.uk/answer/1/www.aa// (yes this is a valid url) will redirect to: mydomain.co.uk/answer/1/new.html if you don't want this b

Categories : Regex

Nginx auth_basic and rewrite in subdirectory does not work
Use: error_page 404 =200 /my-project/index.php; instead of ugly rewrites: if (-f $request_filename) { break; } rewrite ^(.*)$ /my-project/index.php last; Reference: http://nginx.org/r/error_page http://wiki.nginx.org/IfIsEvil http://wiki.nginx.org/Pitfalls P.S. try_files doesn't work with alias because of bug: http://trac.nginx.org/nginx/ticket/97, but you can replace alias with root directive: http://nginx.org/r/root

Categories : Nginx

Nginx - Rewriting url to $url.php, and if doesn't exist, rewrite to $url/
Try using try_files: http://wiki.nginx.org/HttpCoreModule#try_files For example (untested): try_files $uri $uri/ /test.php

Categories : Nginx

nginx: error_page dont work with rewrite
Please take a look at the directive recursive_error_pages, and it works for me. And kudos to Jim D.

Categories : Nginx

How to rewrite rules with nginx regular expressions
Ok this is a bit too specific redirect but as far as I understand is you don't need any thing more than this location /local/airports/(.*)-2 { return 301 http://example.com/local/airports/$1; }

Categories : Nginx

NGINX redirect rewrite "/([0-9]+)" /showthread.php?t=$1 break;
The problem is that you're trying to match something that doesn't exist in the URI, your regex exists in $args and $query_string, I'm not sure if this will work but you can try if ($args ~ "threads/.*.([0-9]+)$") { try_files /showthread.php?t=$1 =404; }

Categories : Nginx

Magento 1.7 REST API nginx rewrite rule. api.php no executed
I saw that post, too, and got the same thing. I changed the rule from break to last and things seem to work now: location /api { rewrite ^/api/rest /api.php?type=rest last; } I believe it works this way because last re-scans the rewrites and can execute your '.php' location directive, where break only considers the current location block (/api). Source: http://wiki.nginx.org/HttpRewriteModule#rewrite

Categories : Api

Rewrite Rule translate from Lighttpd Regex to NginX
I don't really know much about lighttpd configs, you'll need to explain to me so i could write them in nginx format. Also I don't know what will process the PHP, is it fast-cgi or fpm, or what ? server { server_name example.com; #replace with your domain name index index.php; location / { try_files $uri $uri/ /index.php$request_uri; } location ~* .php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; } }

Categories : Regex

Rewrite rule with nginx replace get variable with slach
You're doing it backwards, try this. rewrite ^/auction/([^/]*)/([0-9]*) /auction.php?$1=$2 piece of advice, if this is a custom application you're writing without a framework, you could find a routing module that you could use and it would help you do every thing easily.

Categories : Nginx

nginx rewrite rules failing - causing 503 errors
This isn't a real answer yet, but a rewrite for your redirect block ( until you provide more info on the error log ) Also please verify that the php sock file is actually located at /tmp/website.co.sock change this server { listen *:80; server_name website.co; rewrite ^(.*) http://www.website.co$1 permanent; } to this server { listen 80; server_name website.co; return 301 $scheme://www.website.co$request_uri; } It's more efficent because it doesn't need a rewrite engine.

Categories : Nginx

nginx reverse_proxy with axis camera - default rewrite not working
Try replacing your proxy_redirect with this line proxy_redirect http://192.168.0.205:80/; http://192.168.0.205:80/camera/; I don't know what your Location header says exactly, but you should get the idea, replace the IP with a hostname or whatever the redirect is trying to take you, you're simply telling nginx to append /camera to whatever redirect the website asks you to do

Categories : Nginx

Redirecting all PHP Request to router in Nginx rewrite (Tonic Framework)
You can try something like location /v2 { root <absolute folder path>/v2; if (!-e $request_filename) { rewrite ^/(.*)$ /v2/router.php?/$1 last; break; } } Hope it helps.

Categories : PHP

mass virtual hosting and rewrite rules causing recursive internal redirect
There target of a rewrite rule (the 2nd parameter) can either be a file-path or a URL-path. When it's not clear what it is, mod_rewrite guesses, and it looks like it may be guessing that it's a file-path. A few things you can try: Add a rewrite base or make the target an absolute URL-path by adding a leading / Add an extra condition to check if the URI starts with /web/ Maybe, add another condition to check if the target exists For 1 and 2: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^$ /web/ [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !^/web/ RewriteRule ^(.*)$ /web/$1 [QSA,L] </IfModule> possibly 3: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^$ /we

Categories : Apache

How was `outer` used in Informix-flavored SQL?
Am I correct that OUTER is just shorthand (maybe Informix-flavored shorthand) for LEFT OUTER JOIN? Yes you are completely correct. Quoting from a Informix-4GL Reference Manual Query 1 - Using a Simple Join SELECT customer.customer_num, lname, order_num FROM customer, orders WHERE customer.customer_num = orders.order_num Query 2 - Using an Outer Join SELECT customer.customer_num, lname, order_num FROM customer, OUTER orders WHERE customer.customer_num = orders.customer_num In Informix a join is specified as outer when OUTER is placed in front of the table that can contain null values.

Categories : SQL

Where is my nginx being configured? Changing nginx.conf still brings me to the 'Welcome to nginx' page
when you rewrited the nginx.conf in the folder of source code of nginx and installed it firstly, it will be copied to /usr/local/nginx/conf/nginx.conf (without specially modification of the configure in the folder of source code). But when you do this secondly, the nginx.conf in the folder of source code will be copied to /usr/local/nginx/conf/nginx.conf.defualt,and it usually don't work unless you use nginx -c /usr/local/nginx/conf/nginx.conf.defualt to assign its configure file evertime. There is a line NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" in your script above,which indicates the configure file clearly. To handle this, I suggest rewrite /usr/local/nginx/conf/nginx.conf (not the one in the folder of source code) instead.

Categories : Nginx

How to add redirection rule and rewrite rule in Azure for xcart application hosted in azure
You need to look at IIS url rewrite module for redirection and rewrite. See here. This tool basically writes the rules to web.config file. Update:What you can do is, on a machine with IIS installed, install this module. Then run this tool locally and create rules using this tool. This tool will write the changes to web.config file of the app on which you try to run this tool. See this example Google and you may find some migration tool.

Categories : Azure

jQuery Cycle - change cycle options on click
Assuming your cycling element is $("#maximage"), try this: changedOpts = $("#maximage").data('cycle.opts'); changedOpts.fx = 'scrollHorz'; $("#maximage").data('cycle.opts', changedOpts);

Categories : Misc

TextMate Live Preview of GFM (GitHub flavored Markdown)
Yes, it's possible to make a preview without file saving, just run Bundles > Markdown Redcarpet > Preview or here is a shortcut for this: ⌃+⌥+⌘+P. To use a keyboard shortcut properly, I recommend to uninstall original Markdown bundle.

Categories : Misc

best practice for flavored build variants with gradle in android studio
Another solution is to put everything shared (basically the a "vanilla" version of your app) as a libary project, including default resources. Then you can create seperate "brand" projects that use the library project. Any resources you put in these will "overwrite" the library project resources. http://developer.android.com/tools/projects/projects-eclipse.html#SettingUpLibraryProject I've done this for clients and it's worked quite well.

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.