Php 子域为每个用户使用.htacces
我正在使用AmazonEC2。 我不是.htaccess方面的专业人士,我参考了以下.htaccessPhp 子域为每个用户使用.htacces,php,apache,.htaccess,amazon-ec2,Php,Apache,.htaccess,Amazon Ec2,我正在使用AmazonEC2。 我不是.htaccess方面的专业人士,我参考了以下.htaccess RewriteCond %{HTTP_HOST} ^([\w-]+).example.com$ RewriteCond %{REQUEST_URI} !^/example.com/ RewriteRule ^(.*)$ /example.com/$1?subdomain=%1 [LAST,QSA] 当我尝试执行这个username.example.com到examp
RewriteCond %{HTTP_HOST} ^([\w-]+).example.com$
RewriteCond %{REQUEST_URI} !^/example.com/
RewriteRule ^(.*)$ /example.com/$1?subdomain=%1 [LAST,QSA]
当我尝试执行这个username.example.com
到example.com/subdomain?id=username
我使用的是EC2亚马逊服务器
第一个问题是,如果我试图执行username.example.com
,则此域未得到解决
第二个问题上述htaccess不适用于我。如果有人能解决这一问题,这将很有帮助您不能使用
.htaccess
文件来解决这一问题,您需要设置一个通配符虚拟主机,然后将其重写为所需的URL
这可能很有用,您也可以参考它。我已经尝试了链接中给出的东西。。但不工作这是一种方法没有其他方法,编辑后是否重新启动服务器\apache?是的,我重新启动了服务器