Php apache2上的符号链接和htaccess
我们在ec2上有一台ubuntu机器作为服务器,默认的Php apache2上的符号链接和htaccess,php,apache,.htaccess,codeigniter,Php,Apache,.htaccess,Codeigniter,我们在ec2上有一台ubuntu机器作为服务器,默认的/var/www/html有一个指向/home/ubuntu ubuntu@ip-172-XX-XX-XXX:/var/www/html$ ls -al total 20 drwxrwxrwx 2 root root 4096 Sep 10 02:19 . drwxr-xr-x 3 root root 4096 Sep 10 02:17 .. -rw-r--r-- 1 root root 11321 Sep 10 02:17 index.
/var/www/html
有一个指向/home/ubuntu
ubuntu@ip-172-XX-XX-XXX:/var/www/html$ ls -al
total 20
drwxrwxrwx 2 root root 4096 Sep 10 02:19 .
drwxr-xr-x 3 root root 4096 Sep 10 02:17 ..
-rw-r--r-- 1 root root 11321 Sep 10 02:17 index.html
lrwxrwxrwx 1 root root 20 Sep 10 02:19 website -> /home/ubuntu/website
目录/home/ubuntu/website
包含
public_html/app/
这是CodeIgniter的总部(基地)。当我以
http://ec2-34-XXX-XX-XXX.compute-1.amazonaws.com/website/public_html/app/index.php/login
我可以看到页面加载正确。但当我以
http://ec2-34-XXX-XX-XXX.compute-1.amazonaws.com/website/public_html/app/login
我不能-它显示了
Not Found
The requested URL /website/public_html/app/login was not found on this server.
.htaccess文件如下所示:
RewriteEngine on
RewriteBase /website/public_html/app/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /website/public_html/app/index.php/$1 [L]
我错过了什么?(Mod Rewrite已启用。)
我认为RewriteBase是个问题,因为它复制了RewriteRule中的规则。有两个问题:
重新编写引擎打开
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$/website/public_html/app/index.php/$1[L]
sudo tail/var/log/apache2/error.log
[Wed Oct 11 19:41:36.396178 2017] [core:alert] [pid 30110] [client 130.245.192.0:27286] /var/www/html/website/public_html/.htaccess: Expected </IfModule> before end of configuration
[Wed Oct 11 19:44:11.269472 2017] [core:alert] [pid 30106] [client 130.245.192.0:13926] /var/www/html/website/public_html/.htaccess: Expected </IfModule> before end of configuration
[Wed Oct 11 19:44:14.046920 2017] [core:alert] [pid 30108] [client 130.245.192.0:22481] /var/www/html/website/public_html/.htaccess: Expected </IfModule> before end of configuration
[Wed Oct 11 19:44:15.465143 2017] [core:alert] [pid 30107] [client 130.245.192.0:19889] /var/www/html/website/public_html/.htaccess: Expected </IfModule> before end of configuration
[Wed Oct 11 19:41:36.396178 2017][core:alert][pid 30110][client 130.245.192.0:27286]/var/www/html/website/public_html/。htaccess:预计在配置结束之前
[2017年10月11日星期三19:44:11.269472][core:alert][pid 30106][client 130.245.192.0:13926]/var/www/html/website/public_html/.htaccess:预计在配置结束之前
[2017年10月11日星期三19:44:14.046920][core:alert][pid 30108][client 130.245.192.0:22481]/var/www/html/website/public_html/.htaccess:预计在配置结束之前
[2017年10月11日星期三19:44:15.465143][core:alert][pid 30107][client 130.245.192.0:19889]/var/www/html/website/public_html/.htaccess:预计在配置结束之前
问题也出在/public\u html目录中的.htaccess文件上 .htaccess文件位于
/website/public\u html/app/
中?是的,谢谢,问题现已解决!
[Wed Oct 11 19:41:36.396178 2017] [core:alert] [pid 30110] [client 130.245.192.0:27286] /var/www/html/website/public_html/.htaccess: Expected </IfModule> before end of configuration
[Wed Oct 11 19:44:11.269472 2017] [core:alert] [pid 30106] [client 130.245.192.0:13926] /var/www/html/website/public_html/.htaccess: Expected </IfModule> before end of configuration
[Wed Oct 11 19:44:14.046920 2017] [core:alert] [pid 30108] [client 130.245.192.0:22481] /var/www/html/website/public_html/.htaccess: Expected </IfModule> before end of configuration
[Wed Oct 11 19:44:15.465143 2017] [core:alert] [pid 30107] [client 130.245.192.0:19889] /var/www/html/website/public_html/.htaccess: Expected </IfModule> before end of configuration