URL rewrites

117 views
Skip to first unread message

apomin

unread,
Nov 3, 2015, 6:34:26 AM11/3/15
to mongoose-users
Hi,

I use Mongoose server on Windows machine for local debugging of my website

The site uses C++ script (exe file)

My current Mongoose configuration layout:

cgi_pattern **.exe$
enable_directory_listing yes
document_root C:\inetpub\mttry\wwwroot

Typical request to server:
http://localhost:8080/m.exe?s=code&l1=1&l2=2

I would like to use URL rewrite to omit script name in address line:
http://localhost:8080/s=code&l1=1&l2=2
should redirect to
http://localhost:8080/m.exe?s=code&l1=1&l2=2

In fact all calls to server should redirect to script along with parameters of current request

What is the correct config line for that?

Sergey Lyubka

unread,
Nov 5, 2015, 4:28:37 AM11/5/15
to mongoose-users
If you want to redirect all requests to your script, and hide the script name, try this:

url_rewrites  **=/full/path/to/your/exe

Please let me know how it goes.

--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-user...@googlegroups.com.
To post to this group, send email to mongoos...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

apomin

unread,
Nov 5, 2015, 5:23:47 AM11/5/15
to mongoose-users
Hi,

Thank you, it works
However, it passes all requests to script including *.css and *.gif files
I would like server to deliver static files in the ordinary way
Are there any exception rules, like passing some requests to script but dealing with static files in ordinary way?
For example,
/en/ru/code - pass to script
/style.css - just handle naturally

As far as I get it, Mongoose handles rule templates by checking prefixes, that is, the matching of template starting bytes with the actual request string
What about masks like *.css or *gif?

Sergey Lyubka

unread,
Nov 5, 2015, 7:51:32 AM11/5/15
to mongoose-users
You can put all dynamic content into some directory, and have a rewrite rule that starts with that directory prefix.


url_rewrites  /api/**=/full/path/to/your/exe



--

Словарь Мультитран

unread,
Nov 5, 2015, 9:22:43 AM11/5/15
to mongoos...@googlegroups.com
I would like to have simple address structure like
mysite.ru/en/ru/word
that should translate to
mysite.ru/m.exe/en/ru/word

While simple file links
mysite.ru/style.css
should work directly without rewrites
IIS rewrites have rules like 'is file', 'is not file', 'is a directory' etc.

Is there any distinction between scripts and static files in Mongoose config?

If I put script to API directory, the address in browser would look like
mysite.ru/api/en/ru/word
is that what you mean?

Actually I had special directory for scripts before but there were issues with relative paths for javascript, etc
Some functionality of the site did not work. I could not figure out what it was but problems disappeared when I moved script to root



Добрый день,


С уважением,
Андрей Поминов
www.multitran.ru
+7 916 692-42-74
p...@aha.ru


--
You received this message because you are subscribed to a topic in the Google Groups "mongoose-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongoose-users/cLkoZbTFJUY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongoose-user...@googlegroups.com.

Sergey Lyubka

unread,
Nov 5, 2015, 12:39:39 PM11/5/15
to mongoose-users
Здравствуйте Андрей!
Приятно познакомиться с разработчиком Мультитран!

Mongoose does not provide an advanced rewrite capability.
It is possible however to achieve the result by enumerating all possible languages using alternation syntax, for example:

url_rewrites /en/**|/ru/**|/de/**=/path/to/script.exe

Then, only URIs that start with en, de, ru will be rewritten.
Please let me know how it works for you.

Regards,


On Thu, Nov 5, 2015 at 2:22 PM, Словарь Мультитран <mtd...@gmail.com> wrote:
I would like to have simple address structure like
mysite.ru/en/ru/word
that should translate to
mysite.ru/m.exe/en/ru/word

While simple file links
mysite.ru/style.css
should work directly without rewrites
IIS rewrites have rules like 'is file', 'is not file', 'is a directory' etc.

Is there any distinction between scripts and static files in Mongoose config?

If I put script to API directory, the address in browser would look like
mysite.ru/api/en/ru/word
is that what you mean?

Actually I had special directory for scripts before but there were issues with relative paths for javascript, etc
Some functionality of the site did not work. I could not figure out what it was but problems disappeared when I moved script to root



Добрый день,


С уважением,
Андрей Поминов
www.multitran.ru
+7 916 692-42-74
p...@aha.ru


On Thu, Nov 5, 2015 at 3:51 PM, Sergey Lyubka <val...@gmail.com> wrote:
You can put all dynamic content into some directory, and have a rewrite rule that starts with that directory prefix.


url_rewrites  /api/**=/full/path/to/your/exe


Reply all
Reply to author
Forward
0 new messages