开发者

Mod Rewrite Help

I have some basic knowledge of Mod Rewrite, but I can't figure this out!

I want

http://example.com/posts/[NAME]/~[ID]/#[PAGE]

and be able to get it like $_GET['name'], $_GET['id'], and $_GET['page']

NAME is a en escaped string, so it allow A-Za-z1-9 and the special characters ?_-! (and replaced with %20, etc. , any amount of characters.

ID is a-zA-Z1-9, any amount of characters.

PAGE is a number, any amount of characters.

Also, I'm trying now: [NAME]-[ID]/[PAGE]/ but I don't need to $_GET['name'] in this one.

Having t开发者_JAVA技巧rouble getting this to work, as so far, I only really know how to do mod rewrite with ONE variable.

Thanks in advance.


[NAME]/~[ID]/#[PAGE]:

RewriteEngine On
RewriteRule ^posts/([^/]+)/\~([^/]+)/#(\d+)$ your_file.php?name=$1&id=$2&page=$3 [QSA,L]

[NAME]-[ID]/[PAGE] without $_GET['name']:

RewriteEngine On
RewriteRule ^posts/[^\-]+\-([^/]+)/(\d+)$ your_file.php?id=$1&page=$2 [QSA,L]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜