htaccess (Apache) RewriteRule Custom Match (PHP)

HTACCESS file:
RewriteRule ^(mywork|ajx)(.*)$ index.php?requestroute=$1$2 [QSA,L]

Usage(s) and Explanation.

  1. ^(work|ajx) :
    match from request URI that contain string work or ajx.separated with vertical line.
  2. (.*) :
    accept everyting request URI after first match.
Debug result with PHP:
  1.  ~/work
    [requestroute] => work
  2. ~/work/
    [requestroute] => work/
  3. ~/work/lorem
    [requestroute] => work/lorem
  4. ~/work/lorem
    [requestroute] => work/lorem/
  5. ~/work/lorem/////////dolor
    [requestroute] => work/lorem/dolor

Komentar

Postingan populer dari blog ini

windows 11 remove usb write-protected

Tutorial susah instalasi GeoServer di Windows

Bagian-bagian Browser

nyoblos perdana