Jump to content

Using Processwire as backend


101Bram
 Share

Recommended Posts

Hey,

I'm using processwire as a backend service (as a REST API to be more specific). I would like to let my server point at my index.html file (It is not possible to change this to a php file for many reasons), but without the index.php processwire won't work. Can processwire be used if I for example move the index.php file to a subdirectory?

Kind regards,

Bram

Link to comment
Share on other sites

The problem is I don't use php except for calling the API. 

My guess is if I go to website.com/pw_api/some_template/, Apache first looks for the file index.php, processwire is initialized and handles the route. Without the index.php the url /api/some_template doesn't have any meaning for the server.

Link to comment
Share on other sites

Not sure I understand what you are trying to achieve. You need PHP to use PW, you cannot use it from html only. 

Why don't you install processwire on www,yoursite.com/api/ subdirectory? There your /index.html could be static html/js and then /api/* would go for pw.

  • Like 3
Link to comment
Share on other sites

you should just be careful when installing pw into a subdir because sometimes this can break paths... for example if there is any link pointing to the root ( "/" ) it would NOT point to the right direction, because it should actually point to "/api/"

you could overcome this using a subdomain. if thats possible in your case i would recommend using api.yourdomain.com instead of yourdomain.com/api/

Link to comment
Share on other sites

Would that be an option: Run Processwire as your main entry point / site and echo the html file in the home template to render it?

<?php
echo file_get_contents("index.html");

or

Using rewrite rules. So yourdomain.com/ will point to index.html but anything else points to processwires index.php
(But I'd have to do some research to post a working anwer now ... just for inspiration)

 

hah, just realized this is kinda solved ;P

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...