LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Need to convert nginx regex to apache regex (https://www.linuxquestions.org/questions/linux-server-73/need-to-convert-nginx-regex-to-apache-regex-4175595004/)

centosfan 12-07-2016 04:19 PM

Need to convert nginx regex to apache regex
 
I made a simple url redirect script which works with sqlite but for some reason nginx and php-fpm is causing a deadlock, and this isn't first time seeing deadlock on script which uses single file to store data, so i need to switch to apache due this problem as apache does not have this problem.
But while apache regex can be easily converted to nginx regex by using online tools,
that's not a case when doing reverse convert.
So here is regex which i need to convert:

rewrite ^/out?$ http://bla.org/all.php?page=one&url=...a.php?page=two last;
rewrite ^/(.*)/(.*)$ /bla.php last;

bathory 12-08-2016 05:22 AM

Quote:

So here is regex which i need to convert:

rewrite ^/out?$ http://bla.org/all.php?page=one&url=...a.php?page=two last;
rewrite ^/(.*)/(.*)$ /bla.php last;
The 2nd rewrite is straightforward
As for the 1st, are you trying to match just /ou and /out URIs? If that's the case then use:
Code:

RewriteEngine On

RewriteRule ^/out?$ http://bla.org/all.php?page=one&url=http://bla.org/bla.php?page=two [L]
RewriteRule ^/(.*)/(.*)$ /bla.php [L]

Regards


All times are GMT -5. The time now is 04:14 AM.