简体   繁体   中英

Apache mod rewrite .htaccess

I can get basic tests to work with mod rewrite ie:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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