Niks Niks - 1 month ago 13
Apache Configuration Question

How to mod_rewrite "?u="

I would like to rewrite from

https://example.com/plugins/mediaplayer/site/_embed.php?u=57aa2050dcba22df


to

https://example.com/embed/57aa2050dcba22df


This is what im using now:

RewriteEngine On
RewriteRule ^embed/?$ \/plugins\/mediaplayer\/site\/\_embed\.php [NC,L]


Result:

https://example.com/embed/?u=57aa2050dcba22df


How to rewrite ?u= ?

Regards

Answer

Assuming your hashing algorithm only involves letters a-z and numbers 0-9..

RewriteBase /
RewriteRule ^embed/([a-z0-9]+)$ plugins/mediaplayer/site/_embed.php?u=$1