1
存在我想做某事像这一点,如果子域是网址:路线,只有当子域网址
http://example.com/ -> index.php
http://hello.example.com/ -> profile.php?subdomain=hello
http://whatever.example.com/ -> profile.php?subdomain=whatever
http://example.com/world -> world.php
http://example.com/world/test -> world.php?id=test
http://example.com/sth -> sth.php
http://example.com/sth/test2 -> sth.php?id=test2
http://hello.example.com/world/test -> profile.php?subdomain=hello
而对于其他的文件:
RewriteRule ^dodaj_artykul dodaj_artykul.php [L]
RewriteRule ^logowanie logowanie.php [L]
RewriteRule ^rejestracja rejestracja.php [L]
RewriteRule ^wyloguj wyloguj.php [L]
RewriteRule ^kategorie/([^-]+)$ kategorie.php?id=$1 [L]
RewriteRule ^kategorie/$ kategorie.php [L]
RewriteRule ^kategorie$ kategorie.php [L]
如果子域存在,一切都被路由到 “?profile.php子域=你好” 如果不存在正常的 “重写规则^ kategorie /([^ - ] +)?$ kategorie.php ID = $ 1 [L]”
嗯,我有“500内部服务器错误” – xtr3mist
@ xtr3mist对不起,请参阅上面的编辑。 –