问题描述
我想重写一个 url,但总是得不到足够的结果.
I would like to rewrite an url, but I always do not get any adequate results.
我想要网址http://something.domain.com/index.php?arguments...实际访问http://domain.com/index.php?username=something&arguments...
I would like the urlhttp://something.domain.com/index.php?arguments...to actually visithttp://domain.com/index.php?username=something&arguments...
我曾尝试创建通配符条目 *.domain.com 并在互联网上使用一些代码,但没有任何效果.
I have tried with making a wildcard entry *.domain.com and using some code on the internet, but nothing worked.
我不断收到默认网站页面"任何想法如何解决这个问题?
I keep getting a "Default Website Page"Any ideas how to solve this problem?
推荐答案
您可以在 something
域的 DOCUMENT_ROOT/.htaccess
文件中使用此代码:
You can use this code in your DOCUMENT_ROOT/.htaccess
file of something
domain:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.(domain\.com)$ [NC]
RewriteRule ^(index\.php)$ http://%2/$1?username=%1 [L,QSA,NC,R]
这篇关于.htaccess 子域 url 重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!