.htaccess将限制字符重定向到URL

时间:2011-08-07 09:58:07

标签: .htaccess url-rewriting

我有一个内联网,分类为admin / mgmt / rest。该网址为intranet.com。对于管理,Intranet将是intranet.com/erw,不超过3个字符。我想使用.htaccess 3个字符重定向到特定的网址。

RewriteCond %{HTTP_HOST} ([0-9][a-z]) [NC] <--want a limit of 3 characters only
RewriteRule (.*)$ http://intranet.com/tek

1 个答案:

答案 0 :(得分:0)

我不确定我是否理解

# match all intranet 1-3 length domains
RewriteCond %{HTTP_HOST} ^([0-9a-z]{1-3})$ [NC]
# redirect to url with domain name
RewriteRule (.*)$ http://intranet.com/%1