我在我的ubuntu机器上安装了一个在线网站用于开发目的。
除了网站的一个部分外,一切正常。当我将浏览器指向http://localhost.000-wordpress.co/app
时,我的apache2错误日志中出现以下错误:
[Fri Jan 17 16:57:03 2014] [error] [client 127.0.0.1] File does not exist: /var/www/app, referer: http://localhost.000-wordpress/
服务器正在我文件系统的错误位置查找app文件夹。所以我创建了一个.htaccess文件,但我不知道如何为此编写重写规则。
我应该如何编写重写规则来告诉服务器转到/home/ross/public_html/000-wordpress/public/app
而不是/var/www/app
?
这是我的 .htaccess文件:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
按照Covner的建议后,我用{/ p>更新了我的apache2.conf
文件
Alias /app /home/ross/public_html/000-wordpress/public/app
<Directory /home/ross/public_html/000-wordpress/public/app>
Order deny,allow
</Directory>
但是这又抛出了两个不同的错误:
[Sat Jan 18 23:35:55 2014] [error] [client 127.0.0.1] PHP Warning: require_once(/home/ross/public_html/000-wordpress/public/app/../vendors/yii/framework/yii.php): failed to open stream: No such file or directory in /home/ross/public_html/000-wordpress/public/app/index.php on line 12, referer: http://localhost.000-wordpress/
[Sat Jan 18 23:35:55 2014] [error] [client 127.0.0.1] PHP Fatal error: require_once(): Failed opening required '/home/ross/public_html/000-wordpress/public/app/../vendors/yii/framework/yii.php' (include_path='.:/usr/share/php:/usr/share/pear') in /home/ross/public_html/000-wordpress/public/app/index.php on line 12, referer: http://localhost.000-wordpress/
答案 0 :(得分:1)
你不想在htaccess中做任何事情,只需使用正常的配置文件(它们都是相同的)
Alias /app /home/ross/public_html/000-wordpress/public/app
<Directory /home/ross/public_html/000-wordpress/public/app>
Order deny,allow
</Directory>