I'm using an API that puts a unique id in the route and then I need that unique ID moved into my internal routing (so php can work with it).

The url is:


The file on the server to host is actually located at:


So I need to turn the original URL into:


Any ideas of a rewrite rule that would do what I need?

(Duplicate question closed on stackoverflow.)


How about

RewriteCond %{REQUEST_URI} /folder/[^\/]+/index.php
RewriteRule /folder/([^\/]+)/ /folder/index.php/$1
  • I still get a 404 with that – TheStoneFox Mar 11 '13 at 11:11
  • Try enabling the rewrite log and see what you get. – Flup Mar 11 '13 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.