【问题标题】:Apache third level domain name configurationApache三级域名配置
【发布时间】:2013-04-23 08:39:19
【问题描述】:

我有特定的重写,比如

RewriteEngine On 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule .* /app_dev.php

我需要像 hello.epsilon.localhost 和 example.epsilon.localhost 这样的域名将转到 epsilon.localhost 虚拟主机(抱歉我的英语不好)

epsilon.localhost 的完整虚拟主机

<VirtualHost *:80>
    DocumentRoot "C:/Projects/epsilon/web"

    RewriteEngine On 
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteRule .* /app_dev.php

<Directory "C:/Projects/epsilon/web">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

    ServerName epsilon.localhost
</VirtualHost>

对 symfony 2.1 的重写

【问题讨论】:

  • ServerAlias添加到VirtualHost配置并将域和子域添加到hosts文件(system32\hosts)。
  • 我添加了 127.0.0.1 *.epsilon.localhost
  • 和 ServerAlias *.epsilon.localhost 但我需要第三级名称是动态的,但它不起作用
  • 添加规则到.htaccess文件,如果HTTP_HOST不等于epsilon.localhost重写为epsilon.localhost

标签: apache symfony rewrite


【解决方案1】:

我在 Windows 上使用这个 http://sourceforge.net/projects/acrylic/ 作为本地 DNS 服务器 这在虚拟主机配置中

<VirtualHost 127.0.0.1>
ServerName devsite.localhost
ServerAlias *.devsite.localhost

DocumentRoot "C:/httpdocs/devsite"
</VirtualHost>

【讨论】:

    猜你喜欢
    • 2018-12-13
    • 2016-04-09
    • 1970-01-01
    • 2013-06-12
    • 1970-01-01
    • 2013-01-17
    • 2019-11-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多