使用.htaccess从URL中删除index.php?var=

使用.htaccess从URL中删除index.php?var=,php,apache,.htaccess,url-rewriting,Php,Apache,.htaccess,Url Rewriting,我有一个带有参数的url。例如: domain.com/guidelines/index.php?doc=html 我想将其转换为: domain.com/guidelines/html 我知道使用.htaccess是可能的,但我似乎无法让它工作 想法?要使用$\u GET['doc']访问php中的参数,并让用户看到干净的url/guidelines/html,您可以重写如下: RewriteBase / RewriteRule ^/guidelines/(.*)$ /guideline

我有一个带有参数的url。例如:

domain.com/guidelines/index.php?doc=html 
我想将其转换为:

domain.com/guidelines/html
我知道使用.htaccess是可能的,但我似乎无法让它工作


想法?

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

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

我明白了。需要在RewriteCond%{REQUEST_FILENAME}上将这些内容放入
Options+FollowSymlinks RewriteEngine-f RewriteCond%{REQUEST_FILENAME}-重写规则^(.*)$index.php?doc=$1[NC]