Home > Backend Development > PHP Tutorial > 求一个rewrite规则

求一个rewrite规则

WBOY
Release: 2016-06-23 14:21:58
Original
960 people have browsed it

求一个apache rewrite规则
把如下链接
/goods.php?id=111&type=apple
转为
/apple/goods-111.html

实际上没有apple目录,

请问:可以做到吗?


回复讨论(解决方案)

RewriteRule    ^apple/goods-([0-9]+).html$    goods.php?id=$1&type=apple    [NC,L]
Copy after login


未测试,应该可以

是可以的,但发现原来的goods.php?id=111&type=apple 页面正常,
但是rewrite后 的apple/goods-111.html的css文件,图片,由于路径的原因,都没有出来,有没有办法在rule规则里,兼顾到路径?

页面查看源码,看下你的css和图片目录,做个伪静态,和你的这个路径没有什么关系。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template