开发者

Subdomain to page.php?

how would my .htaccess need to开发者_如何学编程 look if I wanted subdomains to forward to a specific page "parameter"

eg; http://subdomain.c.example.com > http://c.example.com/page.php?i=subdomain

I can't figure out how the .htaccess works.


Try this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)\.c\.example\.com$ [NC]
RewriteRule . http://c.example.com/page.php?i=%1 [L,R]

Also, in the future when doing examples, use example.com. That domain is provided in the spec for use in documentation, and is guaranteed not to resolve to someone's real domain.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜