[转]有关Apache alias的一点问题

转自:http://www.thinkphp.cn/topic/11973.html

 

Apache 的Alias 指令映射URL到文件系统的特定区域

一个简单的例子:

Alias /mytest /www/mytest
<Directory /www/mytest>
Order allow,deny
Allow from all
</Directory>

首先,这边有一个项目,已经在本地正常运行,使用的Apache rewrite模式,有分组,url 用的thinkphp的pathinfo。将

其部署到Linux服务器上时就出现一些问题。

1.路径字母大小写问题,开始的时候在windows环境下,有字母大写都没什么问题,Linux环境下立刻显示路径错误。

2.只能访问首页,其他页面访问就会报错

没有。。。。路径下的模板;

:(
无法加载模块:home
等等,发现需要加上index.php才能够正常访问。但是url已经做成pathinfo模式,不能再去改回了。查找服务器rewrite mod是启用的。alias的配置也没问题。
最后把问题定位到url重写问题上,于是经过一番修改(.htaccees文件):
<IfModule mod_rewrite.c>
RewriteEngine on
RedirectMatch 403 /\..*$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
RewriteBase /mytest
# domain rewrite
RewriteCond "%{HTTP_HOST}" "!^www.mytest.com" [NC,OR]
RewriteCond "%{SERVER_NAME}" "!^www.mytest.com" [NC]
RewriteRule "(.*)" "http://www.mytest.com/$1" [L,R=301]
</IfModule>
问题解决。

posted @ 2015-03-02 22:36  Athrun  阅读(357)  评论(0编辑  收藏  举报