Rewriting a URL to a PHP parameter from inside a subdirectory

后端 未结 1 1724
粉色の甜心
粉色の甜心 2020-12-12 01:45

What I\'m asking for is simply rewriting any URL-given sub-directiories to a PHP URL parameter for nicer looking, user friendly URL.

I know that this is possible usi

相关标签:
1条回答
  • 2020-12-12 02:46

    This rule should work for you in your DOCUMENT_ROOT/.htaccess file:

    RewriteEngine On
    RewriteRule ^(directory)/([^/.]+)/?$ /$1/index.php?id=$2 [L,NC,QSA]
    

    Make sure there is no other .htaccess file in directory.

    0 讨论(0)
提交回复
热议问题