Search code examples
.htaccessconfiguration-filescloud9-iderunner

Need example of how to specify start path and filename in Cloud9-IDE (I don't want to use index.php)


I need to specify the filename and start path config settings so that when I run my php project it will start with the correct php file and look in the right place (not the default index.php). However in cloud9 it doesn't look like the htaccess is the correct place for this? I don't think Cloud9 gives us access to htaccess anyway. The c9 documentation (https://docs.c9.io/v1.0/docs/custom-runners) describes editing the existing, or creating a new runner. I'm not experienced with runner syntax and the examples they gave are not enough. But it looks like maybe I'm supposed to use $file_path or $file variables in the runner to accomplish this? Has anyone done this in cloud9? If so can you provide an example?

If the runner is in fact the place to accomplish this, where should the variable and value go in this example:

Blockquote

{
    "cmd": ["go", "run", "$file", "$args"],
    "selector": "source.go",
    "info": "Your code is running :)"
}

Solution

  • I don't think having a custom runner would help. If you trying to run your website with a different index file than index.php, on Cloud9, one way would be to edit the 001-cloud9.conf file directly rather than using a runner, since you need to configure apache to have a non-standard starting document. To set your new default, you can try in the terminal:

    sudo vi /etc/apache2/sites-available/001-cloud9.conf
    

    and edit the <Directory> area to read: source

    <Directory /home/ubuntu/workspace>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
        DirectoryIndex my-new-index.php
    </Directory>
    

    Now try using the default Apache runner to run your PHP app and it should pick up the correct index file.

    Also, regarding .htaccess files:

    However, in general, use of .htaccess files should be avoided when possible. Any configuration that you would consider putting in a .htaccess file, can just as effectively be made in a section in your main server configuration file. Source