9

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

 3 years ago
source link: https://blogread.cn/it/article/1159?f=hot1
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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

浏览:4963次  出处信息

首先申明一下:使用.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改成绝对路径也没有问题。

觉得文章有用?立即:

和朋友一起 共学习 共进步!

建议继续学习:

QQ技术交流群:445447336,欢迎加入!
扫一扫订阅我的微信号:IT技术博客大学习

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK