samedi 1 novembre 2014

htaccess rewrite rule with parameter and point to specific php file


Vote count:

0




I have here my folder structure



Api
-.htaccess
-Foo.php
-Bar.php


And this is my htaccess



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ $1.php [QSA,L]


Whenever I call http://localhost/Api/Foo/Hello/World I got 500 internal server error. I added Hello/World because I want to pass a parameter on it.

However, when I call http://localhost/Api/Foo it is working.

So my question is this, what should be the htaccess' rewrite rule in order to point to specific php file and add a parameter?


Example:

http://localhost/Api/Foo/Hello/World will point Foo.php

and http://localhost/Api/Bar/Hello will point Bar.php



asked 1 min ago







htaccess rewrite rule with parameter and point to specific php file

Aucun commentaire:

Enregistrer un commentaire