简体   繁体   English

Apache mod重写.htaccess

[英]Apache mod rewrite .htaccess

I can get basic tests to work with mod rewrite ie: 我可以使用mod重写进行基本测试,即:

RewriteEngine on
RewriteRule ^index.php$ test.php

But what I'm really trying to accomplish is changing my dynamic url ie: 但我真正想要实现的是改变我的动态网址,即:

detail.php?id=1

to something like 喜欢的东西

detail-id-18.htm

Now this is what I have in place (that I thought would have worked) but of course nothing is happening: 现在这就是我所拥有的(我认为会有效)但当然没有发生任何事情:

RewriteEngine on
RewriteRule detail-id-(.*)\.htm$ detail.php?id=$1   

Try this 尝试这个

RewriteEngine On
RewriteBase /
RewriteRule ^detail-id-([0-9]+)\.htm$ detail.php?id=$1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM