python - How can I put Pyramid in front of a PHP website using the same webserver? -


The scenario is: I currently have an old website that runs on PHP. Over time, that code was hacked and messed up. This is due to a rewrite though, I do not have time to write again but I want to plan for it in the future.

What I need to do now is add a 'Welcome' type page to the website. I would like to code that using the pyramid structure in Pytham.

The old sites url structure is:

  http://website.com/XXXXXX   

where X < / Code> is the shortest URL id.

What I was thinking of doing was to apache LocationMatch config to catch short url:

    

This will then redirect the request to the PHP part of the website. Everything else will be caught by the pyramid.

I'm not sure how to take action. Is there a LocationMatch type block in Apache for else ? How do I tell it to serve PHP files for matches and send the pyramid to everything for / XXXXXX matches?

Server Notes:

  • Apache 2 + PHP (Debian Package)
  • mod_wsgi 3.3
  • Python 2.7

    I'm not sure about Apache configuration, but you can use php for wphp, a wsgi You can use the middleware.



Comments