【发布时间】:2016-10-19 21:37:38
【问题描述】:
我对服务器技术非常陌生。我知道这个问题问了太多次,但我真的没有让它运行。
它与
domain.com/2.0/index.php/test
一起运行,但是当你删除 index.php 时它会抛出
在此服务器上找不到请求的 URL /2.0/test。 Apache/2.2.15 (CentOS) 服务器在 domain.com 端口 443
我的项目结构
-
Public_html
--2.0(这是我的项目文件夹,可以在其中找到 ci。它有 sys、app、.htaccess)
--.htaccess
关于问题
我有两个 htaccess 一个在根目录上面提到的一个在 2.0 文件夹内
奇怪的是,我在 htaccess 文件中写的任何东西都没有任何影响
public_html/.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
public_html/2.0/.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
我的 httpd.conf
<VirtualHost *:443>
ServerAdmin info@domain.com
DocumentRoot /home/natural/public_html
ServerName api01.domain.net
ErrorLog /var/log/httpd/error_log
CustomLog /var/log/access_log common
SSLEngine on
SSLCertificateFile /home/natural/api01.domain.net.crt
SSLCertificateKeyFile /home/natural/api01.domoin.key
<Directory />
Options Indexes FollowSymLinks
Allow from all
AllowOverride None
</Directory>
</VirtualHost>
我搜索了很多,并通过堆栈溢出跟踪所有答案,但没有运气。
【问题讨论】:
-
请更新问题以包含这些 .htaccess 文件的内容。答案可能是在根目录中添加重写条件以排除 2.0 文件夹下的所有内容。甚至将两个文件合并为一个。
-
我更新了添加我的两个 htaccess 的问题
-
添加文件夹结构的图片
-
@AbdulManan 你的项目是 2.0 吗?添加清晰的图像与应用程序文件夹和所有
标签: php apache .htaccess codeigniter mod-rewrite