Use text from URL after slash as parameter - htaccess

Viewed 1398

I need to rewrite this:

http://example.com/new/location/

to:

http://example.com/new.php?p=location

Btw it could be anything after new/ for example i need:

http://example.com/new/anything

to actually be:

http://example.com/new.php?p=anything

But i need to keep the URL structure with the slashes for SEO and security purposes

How could i achieve this using .htaccess?

currently in my htaccess ive got:

RewriteEngine on
RewriteBase /dir/

Thanks

1 Answers
Related