.htaccess RewriteRules for redirecting base64 strings

April 29th, 2019





A while back for Senior Assassins I needed to create an htaccess rewrite rule for base64 strings.

I already had several for different combinations of letters and numbers but for some reason, the regex for a base64 string wasn’t working for me.

Below is an example of the rule in case it’s of use for anyone:

RewriteRule ^search/([a-zA-Z0-9_=-]+)/?$ search.php?q=$1 [NC,L] # Handle search function

The rule above takes a GET request for

example.com/search/Y29tcHV0ZXJzY2llbmNlaXN1c2VsZXNzcw==/

and redirects to

example.com/search.php?q=Y29tcHV0ZXJzY2llbmNlaXN1c2VsZXNzcw==

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *