【发布时间】:2015-05-13 12:59:46
【问题描述】:
当我运行应用程序时,我想在本地主机上运行我的 CodeIgniter 应用程序,URL 看起来像 https://www.localhost/projects/4all/
然后我对.htaccess 进行了更改,www 已删除,但我的控制器现在无法访问。例如
当我输入 localhost/projects/4all/ 时,它会显示一个空白页。
它不会重定向到routes.php中定义的控制器
.htaccess 在我进行更改之前
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www)\.(.*)\.(.*)\.(.*) [NC]
RewriteRule ^(.*)$ http://%2.%3.%4/$1 [R=301,QSA,L]
#force www on production domain
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
DirectoryIndex index.php
Options -Indexes
RewriteRule ^combine/(.*)$ /application/cache/smarty/cached/$1 [L]
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt|sitemap\.rss)
RewriteRule ^(.*)$ index.php?/$1 [L]
.htaccess 修改后:
# Turn on URL rewriting
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
如果需要一些额外的数据,请给我评论。
【问题讨论】:
-
no mine is deffrent 我已经删除了 index.php 和 www,我的问题是删除 www 和 index.php 后没有显示默认控制器
-
可能是您的新
.htaccess导致apache错误。查看apache错误日志,看看是否是这个原因。
标签: php codeigniter