【发布时间】:2014-04-12 09:47:50
【问题描述】:
我得到了这个网址
/localhost/andalucia/productdetails.php?value=20
我想改成
/localhost/andalucia/productdetails/20
如何做到这一点以及如何在处理程序页面中获得值 20?
我应该更改编码还是只添加一个 ht 访问文件?
如果是添加一个ht访问文件,里面应该有什么代码?
如果我有更多页面,例如:
/localhost/andalucia/product
/localhost/andalucia/home
/localhost/andalucia/contactus
它们也会自动受到影响吗?
好的,我尝试使用
RewriteRule ^productdetails/([0-9]+)$ productdetails.php?value=$1 [L,QSA]
但现在问题是我的所有 图片 都在 html 中消失了,我无法像打开其他 页面 一样
/localhost/andalucia/product
/localhost/andalucia/home
/localhost/andalucia/contactus
我需要一个可以打开所有这些的 htaccess 代码
/localhost/andalucia/product
/localhost/andalucia/home
/localhost/andalucia/contactus
/localhost/andalucia/productdetails/20
请帮助某人
【问题讨论】:
-
您可以使用 htaccess 执行此操作。谷歌重写规则
-
检查此副本是否有您的问题。stackoverflow.com/questions/1231067/…
标签: php url mod-rewrite url-rewriting get