Htaccess规则/ a / b / c到a =& b =& c =

时间:2012-12-16 09:34:57

标签: regex apache .htaccess mod-rewrite

如何使用HTACCESS重定向:
http://www.domain.com/emailreader/10/15/abc

http://www.domain.com/emailreader.php?a=10&b=15&c=abc

2 个答案:

答案 0 :(得分:1)

通过httpd.conf启用mod_rewrite和.htaccess,然后将此代码放在.htaccess目录下的DOCUMENT_ROOT中:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteRule ^(emailreader)/([^/]+)/([^/]+)/([^/]+)/?$ /$1.php?a=$2&b=$3&c=$4 [L,NC,QSA]

答案 1 :(得分:0)

我觉得这样的事情

RewriteRule ^emailreader/([0-9]+)/([0-9]+)/([a-z]+)$ /emailreader.php?a=$1&b=$2&c=$3 [NC,L]