Use different extension on server (instead of .irev)

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
ekek
Posts: 51
Joined: Fri Sep 21, 2012 9:33 am

Use different extension on server (instead of .irev)

Post by ekek » Thu Nov 13, 2014 1:34 am

Hi guys:

Does someone if is it there a way to use a different extension on On Rev Server different to .irev?

Thanks!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8418
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Use different extension on server (instead of .irev)

Post by FourthWorld » Thu Nov 13, 2014 2:14 am

How did you set it to irev?
Richard Gaskin
LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

ekek
Posts: 51
Joined: Fri Sep 21, 2012 9:33 am

Re: Use different extension on server (instead of .irev)

Post by ekek » Thu Nov 13, 2014 5:16 am

Hi Richard:

By default the server accepts the .lc or .irev extensions.

I need to use different extensions like .php, or .mp3, etc. in order to comply with Apple XML specifications for iTunes.

Today I tried to use a web service with the .irev extension and altough it worked ok, iTunes XML service did not recognized it. I've validated that if I use a WS with the .mp3 extension iTunes recognizes it.

Regards

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8418
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Use different extension on server (instead of .irev)

Post by FourthWorld » Thu Nov 13, 2014 5:25 am

Is this hosted on On-Rev, HostM, or another service?
Richard Gaskin
LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

ekek
Posts: 51
Joined: Fri Sep 21, 2012 9:33 am

Re: Use different extension on server (instead of .irev)

Post by ekek » Thu Nov 13, 2014 6:09 am

This test is hosted on On-rev

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8418
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Use different extension on server (instead of .irev)

Post by FourthWorld » Thu Nov 13, 2014 10:35 pm

Thanks. Servers can be configured through different means, so it's helpful to know what type of hosting you have.

I haven't used On-Rev myself, so it may be necessary to write to the support contact for that service if the guidance given here doesn't work.

That said, most shared hosting services like On-Rev provide support for users to modify how their site handles incoming requests through a special file you put on the server named .htaccess.

The LiveCode Server Guide includes info on setting up a server via .htaccess:
http://lessons.runrev.com/s/lessons/m/4 ... -htaccess-

The .htaccess file includes directives which are part of Apache's URL rewrite module (mod_rewrite), which is a fascinating and flexible toolkit useful for a wide range of things. It's well worth reviewing Apache's documentation on that when you have time, since you may dream up all sorts of convenient things to do with it.

For simply assigning specific types of URL requests to a specific app like LiveCode Server, the example shown in the LC Server Guide is:

Code: Select all

Options ExecCGI
AddHandler livecode-script .lc
Action livecode-script /cgi-bin/livecode-server
The first line just turns on the ability to regard certain files as executable - it's the second line that defines the file type handling.

As you see there, the "AddHandler" directive specifies that you want special handling named "livecode-script" to happen when requests for files ending in .lc come in.

That last line defines what the action named "livecode-script" should do, in this case providing the command line to launch LiveCode Server.

To modify that for your needs, you'll need to make two changes:
1. On line 2, change the file type (the last word) to be the file type you want LC Server to handle.
2. On line 3, change the path to the LC Server executable to reflect the one used by your On-Rev host (you may need to get that from Support if it's not already provided in the documentation for the service).

What file extension do you want to use? I should note that while it's possible to use any file type there, it's generally best to avoid using common file types normally handled by other processes. For example, changing that to .php or .html will prevent normal handling of those types, and may cause unpredictable results.

That said, if you're adventurous and have experimented enough to do things like that with confidence, you can use the mod_rewrite directives in .htaccess to do some very useful and interesting things. For example, at my livecodejournal.com site I have a custom CMS made entirely in LiveCode that handles all .html requests with my custom LiveCode CGI. The result is a site that appears to the user to be static HTML, but behind the scenes everything there is dynamically generated by LiveCode on each request.

It took me some experimentation on a local server to make sure it was running the way I want before I deployed it to the public site, but the end result is a flexible system I very much enjoy, thanks to LiveCode and Apache's mod_rewrite.
Richard Gaskin
LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

ekek
Posts: 51
Joined: Fri Sep 21, 2012 9:33 am

Re: Use different extension on server (instead of .irev)

Post by ekek » Fri Nov 14, 2014 4:40 am

Thank you so much Richard, your explanation is one of the best that I've seen and I appreciate the time you took to write it.

I will reach support for asking if is it possible to change .htaccess file on the server.

Best regards!

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8418
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Use different extension on server (instead of .irev)

Post by FourthWorld » Fri Nov 14, 2014 5:05 am

Happy to help. Let me know how it goes.

Server stuff is almost mind-bending to get started with, but each thing you learn builds on the others and before you know you're dreaming up all sorts of fun stuff.

SURGEON GENERAL'S WARNING: LiveCode Server has been found to be highly addictive. Continued use may result in loss of social life, lost weekends, and awesome software.

:)
Richard Gaskin
LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply

Return to “CGIs and the Server”