开发者

Subdomain to page.php?

开发者 https://www.devze.com 2023-03-20 12:36 出处:网络
how would my .htaccess need to开发者_如何学编程 look if I wanted subdomains to forward to a specific page \"parameter\"

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

精彩评论

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