0

because .htacces including the syntax are totally new territory for me, I currently don't know how to create a specific redirect. I have given the following link:

www.example.com/RANDOM_STRING

This link should redirect via .htaccess to a PHP file where RANDOM_STRING is saved into a GET Parameter. Roughly speaking, it should be redirected something like this:

www.example.com/RANDOM_STRING > www.example.com/router.php?link=RANDOM_STRING

Is it even possible to redirect something like this via htaccess?

Thx

SyNoXaT
  • 55
  • 1
  • 5
  • Yes it's quite possible. Have you searched the SO archives on "htaccess redirect" yet? You're more likely to get answers if you show your own effort and explain where the problem is. – Markus AO Jan 22 '21 at 13:37

1 Answers1

2

To redirect /router.php/?link=RANDOM_STRING to /router/ you can try something like the following near the top of your .htaccess file (using mod_rewrite):

RewriteEngine On
RewriteCond %{QUERY_STRING} ^link=
RewriteRule ^link/$ /link/? [R,L]
majkrzak
  • 1,332
  • 3
  • 14
  • 30
Russell
  • 42
  • 5