开发者

How to write the Apache rewrite rule?

Currently I have URLs like these:

http://example.com/d/tag.php?n=1&tag=php
http://example.com/d/tag.php?n=1&tag=cms

I want to add the rewrite rule in .htaccess file.t开发者_如何学运维o make the URL like this:

http://example.com/tag/1/php

How to write such rule?


Here you gou:

 RewriteEngine On
 RewriteRule ^tag/([0-9]*)/(.*)$ tag.php?n=$1&tag=$2

Don't forget to put that in your .htaccess file under your direcrory (d).


have a look to this link

mod_rewrite redirect all the requests linke http://exmple.com/d/tag.php?n=1&tag=php to a specific page there you have to write the code that handle the request

Hope this helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜