Rewrite {query}.ts to ts.php?{query}

Viewed 56

I'm not familiar with mod-rewrite, and I could not find any similar questions or solution. Thank you a lot...

Template:

{query1}_{query2}.ts
ts.php?v={query1}&seg={query2}

Example:

https://example.com/AAAA-000_2.ts
https://example.com/ts.php?v=AAAA-000&seg=2
1 Answers

Could you please try following, written as per shown samples only.

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/([^_]*)_(\d+)\.([\w-]+)/?$ [NC]
RewriteRule ^(.*)$ /%3.php?v=%1&seg=%2 [NC,L]
Related