Wednesday, September 8, 2010
 

htaccess二级目录重写找不到路径

首先申明一下:使用.htaccess文件,会降低httpd服务器的一点性能.h
我们一般会把客户的网站放在自己的网站的目录下面,
比如FTP:/home/ftp/www,
有一个网站http://www.example.com,
那么新建一个网站的目录为http://www.example.com/newsite/,
我们这个项目是使用qeephp开发的,使用qeephp的路由重写功能,在把网站上传到服务器上,
使用了虚拟目录Alias,因为不想看到类似http://www.example.com/newsite/public/这样的路径,
于是外部访问地址是http://www.example.com/newsite,
在我启用了qeephp的rewrite时,一直说找不到路径,/home/ftp/www/newsite/,很奇怪。
仔细阅读htaccess的文档,发现有一个BaseDir参数
在htaccess 中添加

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

问题就解决.
估计把index.php改成绝对路径也没有问题。

 

Tags:

Comments

No comments so far.
  • Leave a Reply
     
    Your gravatar
    Your Name
     
     
     
     
     
 
About This Website

Lamp development & SEO & Plan of Website & Project Managment

Learn more »
Follow Us (SNS)
Help & Support

more about Bruce.xu»

Get in touch

QQ: +252339382
Email: shjuto @ gmail.com

Online contact form »