mod_rewrite like in XF

Robert9

Well-known member
I have a site with some pages like

url.com/target/{dir_id}/{page_id}.php

I would like to call/link this pages with something like

url.com/target/blablab-something-we-dont-care/{dir_id}/{page_id}

and get again

url.com/target/{dir_id}/{page_id}.php


The regex in php is

target/(.*)/(\d+)/(\d+)

url.com/target/blablab-something-we-dontcare/17/298

=>
url.com/target/$2/$3.php

Any idea how to bring this in my .htaccess, please?
 
Last edited:
This should work.
Note: I didn't include blabblab part since you don't need that as I can see.

Code:
RewriteEngine On
RewriteRule ^target/[A-Za-z0-9\-\_]*/(\d+)/(\d+) /target/$1/$2.php [L]
 
Top Bottom