I am trying to port a PHP application to node/express. Right now I am facing the problem to serve some legacy links like www.example.com/test.php
I get the following error from express:
Cannot GET /test.php
How can I serve .php
routes with express/node? Thanks for your help!
You can listen to /test.php as any other URL:
app.get('/test.php',function(req,res){
res.redirect('/YourNewRouter')
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.