开发者

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

开发者 https://www.devze.com 2023-02-25 11:45 出处:网络
I have a url with a parameter in it. For instance: domain.com/guidelines/index.php开发者_StackOverflow?doc=html

I have a url with a parameter in it. For instance:

domain.com/guidelines/index.php开发者_StackOverflow?doc=html 

I want to convert this to:

domain.com/guidelines/html

I know it is possible with .htaccess but I can't seem to get it to work.

Thoughts?


To access the param in php with $_GET['doc'], and have the user see the clean url /guidelines/html you can rewrite as follows:

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

精彩评论

暂无评论...
验证码 换一张
取 消