LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-07-2016, 04:19 PM   #1
centosfan
Member
 
Registered: Jun 2003
Location: Golem city
Distribution: Server - Debian Desktop - Linux Mint
Posts: 219

Rep: Reputation: 32
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;
 
Old 12-08-2016, 05:22 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Confusing issue with Perl regEx - Regex check seems to require variable being set EnderX Programming 1 09-07-2013 04:36 AM
Convert .../($var1|$var2)/... regex to string smartgig Linux - Newbie 6 08-02-2012 09:59 AM
[SOLVED] differences between shell regex and php regex and perl regex and javascript and mysql golden_boy615 Linux - General 2 04-19-2011 01:10 AM
Perl to find regex and print following 5 lines after regex casperdaghost Linux - Newbie 3 08-29-2010 08:08 PM
regex with sed to process file, need help on regex dwynter Linux - Newbie 5 08-31-2007 05:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration