如何为动态生成的链接重写URL

时间:2015-10-02 05:17:52

标签: php html .htaccess url

我创建了一个动态生成的小链接。当我点击将创建这样的URL的链接

http://localhost/store/user.php?id=12

如果我给这个网址

http://localhost/store/user/12

将产生我想看的相同输出

我想要做的是,如果我点击动态生成的链接,应该产生

 http://localhost/store/user/12 

这个网址而不是这个

http://localhost/store/user.php?id=12

我该怎么做

.httaccess文件就是这个

# Enable Rewriting
RewriteEngine on

# Rewrite user URLs
#   Input:  user/NAME/
#   Output: user.php?id=NAME
RewriteRule ^user/(\w+)/?$ user.php?id=$1

1 个答案:

答案 0 :(得分:0)

RewriteRule ^store/user/(\w+)/?$ store/user.php?id=$1
相关问题