更新.htaccess到URL重写

时间:2015-07-24 02:26:16

标签: php .htaccess

我的网址如下:

url.com/show.php?id=abc
url.com/show.php?id=xxx

我该如何将该URL转换为

url.com/abc
url.com/xxx

如何在PHP中创建友好的URL?

1 个答案:

答案 0 :(得分:2)

我猜你想要.htaccess文件中的以下内容

#Turn on the rewriting engine
RewriteEngine On
RewriteRule ^([A-Za-z0-9-]+)/?$ show.php?id=$1 [NC,L]