我已经建立了一个完全免费的网站,带有x10hosting和freenom(.ml)。在这个网站上,我有一个account
子域,它使用public_html
目录中/account/
目录的内容。
一切正常,但是当http://account.lynk.ml/login
被重写时,它会重写为http://www.account.lynk.ml/home/MYUSERNAME/public_html/account/login.php
。
有没有办法让它有网址http://account.lynk.ml/login
?提前谢谢。
htaccess 中的子域代码:
# Account subdomain
RewriteCond %{HTTP_HOST} ^account'.lynk'.ml$
RewriteCond %{REQUEST_URI} !^/account/
RewriteRule (.*) /account/$1
我是子域的新手,所以不要指望我有太多的知识。 ;)
您可能
正在寻找以下内容;它基本上会重写从subdomain.example.com
或subdomain.example.com/account
到/login
的任何内容:
RewriteEngine On
RedirectMatch ^/$ /login
RewriteRule ^login account/$1
RewriteCond %{THE_REQUEST} ^GET' /account/
RewriteRule ^account/(.*) /login/$1 [L,R=301]
这会将内容保留在/account
中,并使 URL 显示为/login