user479947
user479947

Reputation:

RewriteRule to match the end of a filename

I want to use URL's like: filename_ID.csv and change the URL to script.php?id=ID

What would the regex be to catch the ID after the underscore and pass it to my script?

Upvotes: 0

Views: 243

Answers (1)

Phil
Phil

Reputation: 164732

Assuming ID is numeric...

RewriteRule filename_(\d+)\.csv script.php?id=$1 [L,QSA]

Upvotes: 0

Related Questions