.htaccess point子域到文件
我试图做的是能够将类似于.htaccess point子域到文件,.htaccess,.htaccess,我试图做的是能够将类似于username.domain.com的内容指向index.php?url=username。我一直在浏览Google/StackOveflow,没有找到任何对我有利的东西 致以最诚挚的问候。将以下规则添加到文档根目录中的htaccess文件中: RewriteEngine On RewriteCond %{HTTP_HOST} !^(www\.)?domain.com$ [NC] RewriteCond %{HTTP_HOST} ^([^.]+)\.domain.com
username.domain.com
的内容指向index.php?url=username
。我一直在浏览Google/StackOveflow,没有找到任何对我有利的东西
致以最诚挚的问候。将以下规则添加到文档根目录中的htaccess文件中:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.)?domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^([^.]+)\.domain.com$ [NC]
RewriteCond %{REQUEST_URI} !index.php
RewriteRule ^ /index.php?url=%1 [L]
第一个条件确保请求的主机不是www.domain.com或domain.com,下一行匹配并分组子域名,规则本身使用查询字符串url和子域(使用%1反向引用)将所有内容重写为
/index.php
。不起作用。我正在RewriteCond%{HTTP_HOST}上使用RewriteEngine^(www\.)?titancontent.com$[NC]
RewriteCond%{HTTP\u HOST}^([^.]+)\.titancontent.com$[NC]
RewriteRule^/index.php?url=%1[L]
并且它说GC找不到该页面。@BryanParmenter缺少一个条件来排除对index.php
@BryanParmenter的请求,您试图转到哪个url?-我在index.php文件中设置了一个请求,以查看它是否通过php$\u GET命中aviance,但该页面返回时好像它不存在。@BryanParmenter,如果您转到它,它是否工作?另外,当我试图查找aviance.titancontent.com时,它说没有该主机名的DNS条目。