删除index . php ?var=从URL与.htaccess


Remove index.php?var= from URL with .htaccess

我有一个url,其中有一个参数。例如:

domain.com/guidelines/index.php?doc=html 

我想把它转换成:

domain.com/guidelines/html

我知道这是可能的。htaccess,但我似乎不能让它工作。

想法吗?

要在php中使用$_GET['doc']访问参数,并让用户看到干净的url /guidelines/html,您可以重写如下:

RewriteBase /
RewriteRule ^/guidelines/(.*)$ /guidelines/index.php?doc=$1 [NC]