Re: Rewrite rules for Nginx

2022-11-12 Thread Sergey A. Osokin
Hi, hope you're doing well. On Wed, Nov 09, 2022 at 03:59:22PM -0500, Bumb1ebe wrote: > > I am just moving my website from apache to nginx. > > Unfortunately none of the online converters helped me with dealing the > htaccess migration to nginx rewrite rules. > >

Re: Rewrite rules not working

2022-11-11 Thread Francis Daly
On Fri, Nov 11, 2022 at 08:29:44AM -0500, blason wrote: Hi there, > By the way which one would you confirm is preferable method rewrite or > return? It depends, based on what you want to do. For what I think you want, in this case, "return" is simpler. f -- Francis Dalyfran...

Re: Rewrite rules not working

2022-11-11 Thread blason
Thanks appreciate it. Will have to check and confirm. By the way which one would you confirm is preferable method rewrite or return? Posted at Nginx Forum: https://forum.nginx.org/read.php?2,295715,295725#msg-295725 ___ nginx mailing list -- nginx@ngi

Re: Rewrite rules not working

2022-11-11 Thread Francis Daly
On Thu, Nov 10, 2022 at 01:07:23PM -0500, blason wrote: Hi there, > I have a website http://web1.example.local/web1 > Instead I need a rewrite so that if user enters http://web1.example.local it > will be diverted to http://web1.example.local/web1 If you want it to happen, without needing it to

Rewrite rules not working

2022-11-10 Thread blason
Hi Team, I am trying to write a below rewrite rule but somehow this is not working and I would really appreicate if someone can help me on this? I have a website http://web1.example.local/web1 Instead I need a rewrite so that if user enters http://web1.example.local it will be diverted to http://

Rewrite rules for Nginx

2022-11-09 Thread Bumb1ebe
Hello I am just moving my website from apache to nginx. Unfortunately none of the online converters helped me with dealing the htaccess migration to nginx rewrite rules. Can someone help me with rewriting the correctly please? Options +FollowSymlinks RewriteEngine On ServerSignature Off

Nginx rewrite rules codeigniter

2017-05-05 Thread Antonio González
I have an application in codeigniter. This same application has a common code made in codeigniter and then distributed in subdirectories each of which has a configuration, but all pull the same common code. The problem I have is that the application used to run in apache and everything works corr

Rewrite rules

2016-11-29 Thread Daniel
Hi there, i try to setup some rules. I have to rules which conflicts. rewrite ^/(.*?)/(.*?)/(.*)$ /$3; #rewrite ^/$ /a/b permanent; the first Rules is needed from our developer the second rules os for a request. The Goal is to redirect all request on any domain.com to any

Re: Rewrite rules not working

2016-09-11 Thread Francis Daly
On Sun, Sep 11, 2016 at 08:12:00AM -0400, khav wrote: Hi there, > I am trying to make pretty urls using rewrite rules but they are not > working "Pretty urls" usually means that the browser *only* sees the original url, and the internal mangling remains hidden. A rewrite that

Rewrite rules not working

2016-09-11 Thread khav
I am trying to make pretty urls using rewrite rules but they are not working 1. https://example.com/s1/video.mp4 should be rewrite to https://example.com/file/server/video.mp4 location = /s1/(.*)$ { rewrite ^/s1/(.*) /file/server/$1 permanent; } 2. https://example.com/view

Re: Rewrite Rules from apache

2016-07-08 Thread Francis Daly
On Thu, Jul 07, 2016 at 06:49:21PM +0200, Daniel wrote: Hi there, > This is my htaccess Rule: > > RewriteCond %{DOCUMENT_ROOT}/$3 -f > RewriteRule ^(.*?)/(.*?)/(.*)$ /$3 I suspect that some previous part of the htaccess file has a regex which sets $3. What is that? Or, alternatively: What h

Re: Rewrite Rules from apache

2016-07-07 Thread Daniel
Same issue. All images CSS Files and so on are not loaded :( > Am 07.07.2016 um 19:19 schrieb praty...@hostindya.com: > > July 7 2016 10:19 PM, "Daniel" wrote: >> Hi Everyone, >> >> i try to convert some rules from apache htaccess to nginx. >> >> This is my htaccess Rule: >> >> RewriteCond

Re: Rewrite Rules from apache

2016-07-07 Thread pratyush
July 7 2016 10:19 PM, "Daniel" wrote: > Hi Everyone, > > i try to convert some rules from apache htaccess to nginx. > > This is my htaccess Rule: > > RewriteCond %{DOCUMENT_ROOT}/$3 -f > RewriteRule ^(.*?)/(.*?)/(.*)$ /$3 > > I tried these options but it seems not working: > > if (-f $documen

Rewrite Rules from apache

2016-07-07 Thread Daniel
Hi Everyone, i try to convert some rules from apache htaccess to nginx. This is my htaccess Rule: RewriteCond %{DOCUMENT_ROOT}/$3 -f RewriteRule ^(.*?)/(.*?)/(.*)$ /$3 I tried these options but it seems not working: if (-f $document_root/$3){ set $rule_0 1$rule_0; } if ($rule_0 = "1"

Re: Rewrite rules for "random" subfolders

2015-08-15 Thread Muffel2k
Great! It is working now, thank you very much :) Posted at Nginx Forum: http://forum.nginx.org/read.php?2,261008,261031#msg-261031 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx

Re: Rewrite rules for "random" subfolders

2015-08-15 Thread Anoop Alias
Try the below one in the server context ..outside all location blocks. You can enable dedug log and do rewrite_log on; to see if its matching etc. Good Luck! rewrite ^/galleries/album-set/album-2/(.*)-single\.php /galleries/album-set/album-2/single.php?id=$1 last;

Re: Rewrite rules for "random" subfolders

2015-08-14 Thread Muffel2k
Unfortunately not -.- here is a small summary of my vhost server { location / { index index.php index.html index.htm; try_files $uri $uri/ @rewrites; rewrite ^(.*)/(.*)-single\.php $1/single.php?id=$2 last; } location @rew

Re: Rewrite rules for "random" subfolders

2015-08-14 Thread ryd994
Hi, Does this work? rewrite ^(.*)/(.*)-single\.php $1/single. php?id=$2 last; Not tested, so anything could happen. On Fri, Aug 14, 2015, 18:22 Muffel2k wrote: > Hey, > > I would like to migrate my page from a webhoster to my own vServer running > Nginx. So far I got everything up and running

Rewrite rules for "random" subfolders

2015-08-14 Thread Muffel2k
Hey, I would like to migrate my page from a webhoster to my own vServer running Nginx. So far I got everything up and running EXCEPT these stupid .htaccess file. Let me explain: My site contains several galleries with slideshows. When you are watching one of those you click a link which looks li

Re: Rewrite rules in nginx config

2015-07-17 Thread dr.net
Hi Mike, thank's for reply. I haven't posted all the config because the server is maintained and I have to send to administrator only che rewrite config The php-fpm works Posted at Nginx Forum: http://forum.nginx.org/read.php?2,260404,260408#msg-260408 _

Re: Rewrite rules in nginx config

2015-07-17 Thread Miguel C
On Fri, Jul 17, 2015 at 4:12 PM, dr.net wrote: > Hi all, > thank's to accept me in this forum. > > I'm a newbie... I have a problem with a rewrite rules that I imported from > apache > > This is my code > > > index home.php index.php; > location /

Rewrite rules in nginx config

2015-07-17 Thread dr.net
Hi all, thank's to accept me in this forum. I'm a newbie... I have a problem with a rewrite rules that I imported from apache This is my code index home.php index.php; location / { rewrite ^/(.*)?$ /categories.php?cat=$1; rewrite ^/(.*).html?$ /game.php?game=$1; rewrite ^/(.*)

Re: rewrite rules issue

2015-04-22 Thread nicocolt
Hi Francis Ok. Many thanks for your interest of my problem. Best regards Nico Posted at Nginx Forum: http://forum.nginx.org/read.php?2,258184,258308#msg-258308 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx

Re: rewrite rules issue

2015-04-21 Thread Francis Daly
On Tue, Apr 21, 2015 at 09:26:59AM -0400, nicocolt wrote: Hi there, > server { > listen *:80; > > > server_name domain.fr www.domain.fr subdomain.domain.fr; This doesn't match what I thought you had done. > So if host is subdomain.domain.fr, then the url is rewrite to > subdom

Re: rewrite rules issue

2015-04-21 Thread nicocolt
Hello Francis, server { listen *:80; server_name domain.fr www.domain.fr subdomain.domain.fr; root /var/www/domain.fr/web; if ($http_host = "subdomain.domain.fr") { rewrite ^(?!/\b(bar|stats|error)\b)/(.*)$ /bar/$2 last; } index i

Re: rewrite rules issue

2015-04-20 Thread Francis Daly
On Mon, Apr 20, 2015 at 04:12:11AM -0400, nicocolt wrote: Hi there, > I have set a new server block, but i'm facing with the initial problem. > > So let me re-explain it. > > Now i have: > > server name stuff.domain.fr > root /var/www/domain.fr/web/subdomain; On your test system which shows t

Re: rewrite rules issue

2015-04-20 Thread nicocolt
Hi Francis, I have set a new server block, but i'm facing with the initial problem. So let me re-explain it. Now i have: server name stuff.domain.fr root /var/www/domain.fr/web/subdomain; In the subdomain directory i have foo firectory /var/www/domain.fr/web/subdomain/foo/ so now in my browse

Re: rewrite rules issue

2015-04-19 Thread Francis Daly
On Sun, Apr 19, 2015 at 09:53:43AM -0400, nicocolt wrote: Hi there, > I don't understand how to proceed in order to see only > http://subdomain.domain.fr/directory/ instead of > http://subdomain.domain.fr/subdomain/directory/ I'll still suggest root /var/www/domain.fr/web/subdomain; in a sep

Re: rewrite rules issue

2015-04-19 Thread nicocolt
Hello, you're right, my rewrite says that my request is handle like http://subdomain.domain.fr/subdomain/directory/. But it is not that i want. I want that my request is handled like this: http://subdomain.domain.fr/directory/ and i don't want see the intermediate path. I don't understand how to

Re: rewrite rules issue

2015-04-19 Thread Francis Daly
On Sun, Apr 19, 2015 at 04:06:55AM -0400, nicocolt wrote: Hi there, > Here is the directory path: > > /var/www/domain.fr/web/subdomain/directory > > my nginx conf is: > > root /var/www/domain.fr/web > > if ($http_host = "subdomain.domain.fr") { > rewrite ^(?!/\b(subdomain|stats|er

Re: rewrite rules issue

2015-04-19 Thread nicocolt
Hello Thanks for your reply. If I remove the three lines, i get a 404 error. As a reminder, and maybe a little bit more clear :) here is the configuration. Here is the directory path: /var/www/domain.fr/web/subdomain/directory my nginx conf is: root /var/www/domain.fr/web if ($http_host = "

Re: rewrite rules issue

2015-04-18 Thread Francis Daly
On Sat, Apr 18, 2015 at 04:08:54PM -0400, nicocolt wrote: Hi there, > if ($http_host = "subdomain.domain.fr") { > rewrite ^(?!/\b(subpath|stats|error)\b)/(.*)$ /subpath/$2 last; > } > > if in my browser i write: > host.domain.fr/admin (without last /), then I'm redirected to > host.d

rewrite rules issue

2015-04-18 Thread nicocolt
Hello, I have an issue with a rewrite rule for redirect to a subdomain. Here it is: if ($http_host = "subdomain.domain.fr") { rewrite ^(?!/\b(subpath|stats|error)\b)/(.*)$ /subpath/$2 last; } if in my browser i write: host.domain.fr/admin (without last /), then I'm redirected to host

Re: rewrite rules cms phpwcms not working

2015-03-19 Thread dansch8888
I found the problem with the Y. It was this "[PHP] echo date(Y);[/PHP]" code in my CMS content, where the Y not was quoted 'Y'. I changed it to "[PHP] echo date('Y');[/PHP]" and all went fine now. The [PHP] is just a replacement tag of the CMS, where you can render PHP code in the system. All work

Re: rewrite rules cms phpwcms not working

2015-03-18 Thread dansch8888
Hi Francis, I got a way more familar now with this nginx config files. It works fine for me. The only thing that I still not get figured out, is this FastCGI "Y" error. It doesn't happen at the old webserver which is an apache/fastcgi environment, but I cannot play around with this, because it is

Re: rewrite rules cms phpwcms not working

2015-02-24 Thread Francis Daly
On Mon, Feb 23, 2015 at 01:51:41PM -0500, dansch wrote: Hi there, > after some testing I use this rules now. These are working fine with my > environment. That's good to hear. > location ^~ /config/phpwcms/ { deny all; } > location ^~ /filearchive/ { deny all; } > location ^~ /upload/

Re: rewrite rules cms phpwcms not working

2015-02-23 Thread dansch8888
Hi Francis, after some testing I use this rules now. These are working fine with my environment. **Nginx Site Config /etc/nginx/sites-available/default :** map $request_uri $bit_of_qs { default ""; ~/(?P.*)\.html $name; } ... server { ... location ^~ /config/phpwcms/{ deny all

Re: rewrite rules cms phpwcms not working

2015-02-18 Thread Francis Daly
On Tue, Feb 17, 2015 at 06:26:59PM -0500, dansch wrote: Hi there, > I tried your examples and they work very well. > In the next days I will test it more extensive. Good to hear, thanks. > > > > (track|include|img|template|picture|filearchive|content|robots\.txt|favicon\.ico)($|/) > > > - [

Re: rewrite rules cms phpwcms not working

2015-02-17 Thread dansch8888
Hi Francis, thank you for this really good explanation. I tried your examples and they work very well. In the next days I will test it more extensive. > > (track|include|img|template|picture|filearchive|content|robots\.txt|favicon\.ico)($|/) > > - [L] > I think that say "anything that matches th

Re: rewrite rules cms phpwcms not working

2015-02-16 Thread Francis Daly
On Sun, Feb 15, 2015 at 09:02:05AM -0500, dansch wrote: Hi there, I've not tried to use phpwcms. But from the apache config and your description, I think that the following provides some of the information to the php interpreter that it wants. > (track|include|img|template|picture|filearchiv

rewrite rules cms phpwcms not working

2015-02-15 Thread dansch8888
I try to convert apache rewrite rules for CMS phpwcms (www.phpwcms.de), but with the online converter tools and some adjustments recommended at the nginx wiki I still struggle with that. That's my configuration **Server** Debian Whezzy nginx v 1.6.2 php5-fpm 5.5.20-1~dotdeb.1 (fpm

Re: Nginx rewrite non-existent files under sub directory with rewrite rules

2014-11-28 Thread Joyce Babu
Hi Francis, Thank you for the suggestions. I will try them and revert. Regards, Joyce Babu ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx

Re: Nginx rewrite non-existent files under sub directory with rewrite rules

2014-11-27 Thread Francis Daly
On Wed, Nov 26, 2014 at 05:35:06PM +0530, Joyce Babu wrote: Hi there, > I am trying to move a site with a large number (93) of .htaccess files from > Apache to Nginx. There isn't always a 1:1 correspondence between apache and nginx config, so some things will differ. The suggestions below do do

Re: Nginx rewrite non-existent files under sub directory with rewrite rules

2014-11-27 Thread Joyce Babu
I am getting a new dedicated server and need to decide between Nginx and Apache Event MPM. I have received expert advice to use Nginx, but unless I have a solution to this problem I am unable to move to Nginx. I have been trying to solve this for the past 3 days. I have been checking the Nginx debu

Nginx rewrite non-existent files under sub directory with rewrite rules

2014-11-26 Thread Joyce Babu
Hi everyone, I am trying to move a site with a large number (93) of .htaccess files from Apache to Nginx. There are over 800 rewrite rules to convert. To optimize performance, I have decided to place the rules under separate nested location blocks (61 blocks in total). But I am having problem

Re: Rewrite rules from Apache again

2014-06-12 Thread Luciano Mannucci
n / { > > location ^~ /en/ { > > location = /en/pagina.php { > > location ~ \.php$ { > > ...that location, and not in the one two above it. > > Good luck with it, Solved! Moving all the rewrite rules outside the "location&quo

Re: Rewrite rules from Apache again

2014-06-11 Thread Francis Daly
On Wed, Jun 11, 2014 at 06:20:50PM +0200, Luciano Mannucci wrote: > On Tue, 10 Jun 2014 22:43:05 +0100 > Francis Daly wrote: Hi there, > > The rest of the config? > :) > Well, I've posted it in my previous request for help. Beeing > longish I tried to spare some bandwith... :) No worries. It c

Re: Rewrite rules from Apache again

2014-06-11 Thread Luciano Mannucci
On Tue, 10 Jun 2014 22:43:05 +0100 Francis Daly wrote: > The rest of the config? :) Well, I've posted it in my previous request for help. Beeing longish I tried to spare some bandwith... :) > > == > server { > rewrite ^/(.*)_k(.*).htm$ /pagina.php?k=$2 ; > rewrite ^/privacy.php$ /pagina.php

Re: Rewrite rules from Apache again

2014-06-10 Thread Francis Daly
On Tue, Jun 10, 2014 at 06:00:13PM +0200, Luciano Mannucci wrote: Hi there, > works pretty weff if turned into: > > rewrite ^/(.*)_k(.*).htm$ /pagina.php?k=$2 ; > does not work if translated as: > > rewrite ^/privacy.php$ /pagina.php?k=privacy ; > > the request is passed unchanged and I get a

Rewrite rules from Apache again

2014-06-10 Thread Luciano Mannucci
I'm still trying to move everything from apache to nginx. I've successfully translated some rules from the .htaccess: RewriteRule ^(.*)_k(.*)\.htm$ pagina.php?k=$2 works pretty weff if turned into: rewrite ^/(.*)_k(.*).htm$ /pagina.php?k=$2 ; while RewriteRule ^privacy.php$ pagina.php?k=priva

Re: Switching to nginx: php and rewrite rules from apache

2014-06-10 Thread Luciano Mannucci
On Sat, 7 Jun 2014 11:39:55 +0100 Francis Daly wrote: > add something like > > location ~ \.php$ { > fastcgi_pass 127.0.0.1:9004; > } > > so that nginx knows to handle this request the way you want it to. Works! :-) :) I had to add few other things (it was looking f

Re: Switching to nginx: php and rewrite rules from apache

2014-06-07 Thread Francis Daly
On Sat, Jun 07, 2014 at 12:08:05PM +0200, Luciano Mannucci wrote: > On Sat, 7 Jun 2014 10:08:54 +0100 > Francis Daly wrote: Hi there, > > * what request do you make? > new.assirm.it/en/ > > > * what response do you get? > The index.php page source. > > > * what response do you want? > The php

Re: Switching to nginx: php and rewrite rules from apache

2014-06-07 Thread Luciano Mannucci
On Sat, 7 Jun 2014 10:08:54 +0100 Francis Daly wrote: > On Sat, Jun 07, 2014 at 10:50:05AM +0200, Luciano Mannucci wrote: > > Hi there, > > What did I have wrong? > > You left out some useful information: > > * what request do you make? new.assirm.it/en/ > * what response do you get? The inde

Re: Switching to nginx: php and rewrite rules from apache

2014-06-07 Thread Francis Daly
On Sat, Jun 07, 2014 at 10:50:05AM +0200, Luciano Mannucci wrote: Hi there, > I have one site in php developped by the customer that seemed > ok till I discovered that it has a subdirectory with its own .htacess > file. Trying to add the rewriting rules makes the php "dead", only in > the cited s

Switching to nginx: php and rewrite rules from apache

2014-06-07 Thread Luciano Mannucci
Hello list, I'm moving a bunch of sites from Apache to nginx 1.5.13 :). Everything went fine for the static ones and for the sites under wp or joomla. I have one site in php developped by the customer that seemed ok till I discovered that it has a subdirectory with its own .htacess file. Trying

Re: Expires headers for url rewrite rules

2013-10-21 Thread bogdanb
Moving the rewrite rules inside the " ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { " block did the trick. Thanks a lot for the quick reply. Francis Daly Wrote: --- > On Mon, Oct 21, 2013 at 05:52:57AM -0400, bogdanb wrote:

Re: Expires headers for url rewrite rules

2013-10-21 Thread Francis Daly
On Mon, Oct 21, 2013 at 05:52:57AM -0400, bogdanb wrote: Hi there, > location / { > location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { > This works fine for everything except for the images that have the url > rewrite rules (which return 404 Not found). Anyone know what I'm d

Expires headers for url rewrite rules

2013-10-21 Thread bogdanb
In my config I have some url rewrite rules for images as seen below: location / { rewrite ^/custom/path/(.*)/(.*)-(.*).jpg$ /media/images/products/$1/$3.jpg last; } They work just fine. I'm also trying to set Expire headers for all static resources (images, css, js). I've added the

Re: Nginx RP: a lot of rewrite rules

2013-04-04 Thread Francis Daly
On Thu, Apr 04, 2013 at 12:20:42PM +0200, Davide D'Amico wrote: > Il 04/04/13 11:34, Francis Daly ha scritto: > >On Thu, Apr 04, 2013 at 09:01:17AM +0200, Davide D'Amico wrote: Hi there, > >I suspect that the suggestions are increasingly more efficient -- but > >you presumably have the interest t

Re: Nginx RP: a lot of rewrite rules

2013-04-04 Thread Davide D'Amico
Il 04/04/13 11:34, Francis Daly ha scritto: On Thu, Apr 04, 2013 at 09:01:17AM +0200, Davide D'Amico wrote: Hi there, Is it better to use (in terms of performances, reliability, load on the reverse proxy) the rewrite rules on the nginx reverse proxy, or use the rewrite rules on the apa

Re: Nginx RP: a lot of rewrite rules

2013-04-04 Thread Francis Daly
On Thu, Apr 04, 2013 at 09:01:17AM +0200, Davide D'Amico wrote: Hi there, > Is it better to use (in terms of performances, reliability, load on the > reverse proxy) the rewrite rules on the nginx reverse proxy, or use the > rewrite rules on the apache22 backend? Completely un

Nginx RP: a lot of rewrite rules

2013-04-04 Thread Davide D'Amico
Hi, I've two freebsd 9.1 vm (2 corees, 4gb ram) with nginx-1.2.7 in active/passive mode (using carp), acting as a reverse proxy to 4 apache22 backend (2 cores, 4gb ram). I should set 800 simple rewrite rules, such as: rewrite ^/something/foo.html /bar.html permanent; I cannot use any r

Nginx rewrite rules for phpBB

2013-03-08 Thread Demontager
I need help with phpBB rewrite rules. Used this tool http://winginx.ru/htaccess to convert some rules, but they are not applied. The syntax is ok, so i don't know the problem. Original .htaccess - [code] # Lines That should already be in your .htacess Order Allow,Deny Deny from All Order