How to escape subfolder in slim3 framework being routed by slim3 - php

I have a project built with slim 3 and is working as expected (http://localhost/slimapp/). Now what I want to do is in one of the subfolder run an Angular2 application. But as I try to access the subfolder (http://localhost/slimapp/angularapp/) via browser it is redirected to index.php of slim3, which is quite obvious. What I want to achieve is when I visit http://localhost/slimapp/angularapp/ this URL should not be redirected through slim3 .htaccess and it should run an angular application.
So far I tried in .htaccess is add
RewriteRule ^angularapp($|/) - [L,NC]
This results in 404 not found a page for http://localhost/slimapp/angularapp/.
Any help is much appreciated.
Thanks

instead of rewriting it on the .htaccess level, just create a web-route from slim for that particular path, so instead of you accessing it from the browser, you would access Slim App, and it will access the angular app for you.

Related

Route PHP requests to subfolders in App Engine

To deploy a php app to Google App Engine it says that you need a router, like something in Laravel...the problem is I don't use Laravel (or any other major PHP framework) and I have no intention to. I need to know how to route requests to the appropriate paths in just vanilla PHP. I haven't found any tutorials online that don't deal with a framework or just including client views. Here is what I need:
When a request comes into '/'...it routes to /index.php (obviously this is already happening)
When a request comes into '/account/' it routes to /account/index.php. This is the part I don't know how to do.
I have tried outputting $_SERVER['REQUEST_URI'] and then redirecting the path to the correct place, but $_SERVER['REQUEST_URI'] always just reads '/'.

How to 301 redirect all .asp pages to .php pages on IIS with web.config

as a php programmer, I usually redirect pages with .htaccess, but having inherited a project formerly made with asp, I need to redirect pages to same-named pages in php. For pages that do not exist in php, index.php should be the redirected page.
Would you please help me with some suggestions and resources? I can only find single page to single page redirect.
Thank you very much
First you have to configure the .Net handlers to process your Classic ASP requests
You do that with runAllManagedModulesForAllRequests="true" read more here and here
Next, you can use the built in URL rewrite module to do a wild card replace or a one-to-one map via web.config
As a backup, you can use the Global.asax's Application_BeginRequest event to parse out the requested URL and do a permanent redirect to PHP
Hope this helps

Symfony2 ignore certain route

I have the following situation:
I'm running a Symfony 2 project on a server with the route www.homepage.de.
Every request to a random route on www.homepage.de will be routed to my Landing Page.
Now I want to integrate another project, an API build with Slim PHP and Swagger UI, into this Symfony 2 project. I cloned the project into the /web directory of the Symfony2 project to gurantee access to it.
But now every request I want to do to www.homepage.de/api fails because the Symfony 2 project wants to handle the request and can't find the route. Is there a possibility to tell Symfony2 to ignore every request that is send to the www.homepage.de/api route?
First of all don't add anything to web folder of your application. Just create two applications in different folders. If you want the API to be accessible through the same domain but just with /api you cen use either mod_alias or mod_rewrite to achieve this.
In your current solution it is not Symfony that is intercepting your requests. Take a look at your .htaccess. This is where the magic happens. You can always modify rewrite rules to intercept all /api requests and redirect them to your application but I would still suggest to keep those projects apart.

Slim 404 when moved to godaddy from local turnkey vm

So, I had a working application on a turnkey VM using slim and I decided to move it all to a hosted server when I started having issues with Slim. I got 404 on my endpoint calls. I then brought up fiddler and did a call directly to the index.php that contains the Slim endpoints. I got 404 on that. I then removed all the Slim code from index.php and called it again. This time I got 200. Adding back in the slim code a line at a time it didn't bring back 404 until I brought back
$app->run();
The test calls from fiddler where all directly to index.php and not to an endpoint within it.
Does anyone know what I need to do here? I have no rewrite rules set up in my htaccess.

Seperate Slim from HTML/CSS/JS

So I am confused on how to properly implement the Slim Framework into my use case.
I have a web app html/css/javascript that can not have PHP in it.
All I want to do is use Slim to do some simple GET requests via ajax.
How do I start the App to handle requests if it is never touched int he index.html file?
I'm guessing this has something to do with the .htacess file but not finding anything useful in my initial search.
Got some help on this from the Slim Discussion board.
Here is the answer and example.
Yes, the .htaccess file ensures that any request is handled by a single file (usually index.php but you could name it anything you want).
Your Ajax calls would presumably go to different URLs. Those requests would all be handled by the Slim app.
Example Here

Categories