Mod重写虚拟主机和Zend

发布于 2024-12-17 00:07:23 字数 1561 浏览 0 评论 0原文

我的 Apache 配置:

DocumentRoot /var/www
<VirtualHost *:80>
    Alias /T "/var/www/Test"
    <Directory /var/www/Test>   
        Options Indexes FollowSymLinks MultiViews
        #AllowOverride ALL
        Order allow,deny
        Allow from all
    </Directory>    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel debug
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost>

<VirtualHost *:80>
    SetEnv APPLICATION_ENV "development"
    Alias /N "/var/www/NCAA/public"
    <Directory /var/www/NCAA/public>        
        Options Indexes FollowSymLinks MultiViews
        AllowOverride ALL
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

我的 .htacess 文件位于 /var/www/NCAA/public 中:

RewriteEngine On
RewriteBase   /N/
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

我可以转到 localhost/T 中的文件,但我得到 /localhost/ 的 404 NI 在我的 apache 日志中得到这个:

[Sun Nov 20 16:32:37 2011] [error] [client 127.0.0.1] 文件不存在: /var/www/N

所以我不确定我做错了什么。我希望 1 个域成为带有别名的常规域,另一个域是带有 mod 重写 index.php 的 Zend 应用程序,

谢谢

My Apache config:

DocumentRoot /var/www
<VirtualHost *:80>
    Alias /T "/var/www/Test"
    <Directory /var/www/Test>   
        Options Indexes FollowSymLinks MultiViews
        #AllowOverride ALL
        Order allow,deny
        Allow from all
    </Directory>    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    LogLevel debug
    CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost>

<VirtualHost *:80>
    SetEnv APPLICATION_ENV "development"
    Alias /N "/var/www/NCAA/public"
    <Directory /var/www/NCAA/public>        
        Options Indexes FollowSymLinks MultiViews
        AllowOverride ALL
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

My .htacess file in /var/www/NCAA/public:

RewriteEngine On
RewriteBase   /N/
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

I can go to files in localhost/T, but I get 404 for /localhost/N I get this in my apache log:

[Sun Nov 20 16:32:37 2011] [error] [client 127.0.0.1] File does not exist: /var/www/N,

so I'm not sure what I am doing wrong. I want 1 domain to be a regular domain with an alias and the other is a Zend app with a mod rewrute for the index.php

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

国粹 2024-12-24 00:07:23

您真的需要在 http://localhost/N 下访问 NCAA 应用程序吗?是否可以通过不同的 url(例如 http://local.ncaa/)访问它?

如果是这样,那么虚拟主机条目可能如下所示:

<VirtualHost *:80>
    DocumentRoot /var/www/NCAA/public
    ServerName local.ncaa
    SetEnv APPLICATION_ENV development
    <Directory /var/www/NCAA/public>        
        Options Indexes FollowSymLinks MultiViews
        AllowOverride ALL
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

然后可以使用标准 ZF .htaccess (无需重写基础):

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

Do you really need the NCAA app to be accessed under http://localhost/N? Is it acceptable to access it under a different url, like http://local.ncaa/?

If so, then a virtual host entry could look like:

<VirtualHost *:80>
    DocumentRoot /var/www/NCAA/public
    ServerName local.ncaa
    SetEnv APPLICATION_ENV development
    <Directory /var/www/NCAA/public>        
        Options Indexes FollowSymLinks MultiViews
        AllowOverride ALL
        Order allow,deny
        Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel debug
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Then the standard ZF .htaccess can be used (no rewrite base required):

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文