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

Bagian-bagian Browser

kebiasaan menghapus kontak

Cara Build PHP 7.4.0alpha1 Dari Source Code Pada Ubuntu 16.04 LTS

Referensi "Ni No Kuni: Cross Worlds"