Codeigniter:从本地主机到网络服务器
Helllo everyone。我desperatly试图让codeigniter运行在网络服务器上。 apache mod_rewrite已启用,并且我尝试了几乎所有与Internet上发现的相关的内容,但都没有成功。Codeigniter:从本地主机到网络服务器
在Web服务器上的目录是
在cgi-bin文件夹已经已经存在。我读过的帖子说,cgi-bin文件夹自it is hardly used these days以来无关紧要。 但这是第一个问题:我也支持这个吗?我应该使用哪个.htaccess文件?为什么.htaccess文件放在那里?
他们都不似乎工作: 我试了几个设置,我结束了以下版本两个.htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test94252.test-account.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /test94252.test-account.com/index.htm [L]
</IfModule>
我的目标很简单,如果我叫域http://website.com/那/网站/应用程序/ views/index.php被调用。 这个.htaccess文件有什么问题?
编辑:在我的本地机器上,我通过http://localhost/website/Controller/Function调用该index.php文件。
请注意:为了测试的缘故,我把index.htm放到/ website /中来检查重定向是否完成,但是它不起作用。
我期待着您的回音。
第一:
不,你应该安全,将其删除。 cgi-bin
历史上是唯一可以存储可执行文件或脚本代码(二进制文件,shell脚本等)的地方。由于大多数主机都允许从任何地方执行脚本,因此它主要是历史遗迹。
当一个.htaccess文件被放置在一个通过Apache Web服务器加载的目录中时,Apache Web Server软件会检测并执行.htaccess文件。 .htaccess
可以内容密码保护或图像热链接预防。
二:
你应该./website
文件夹编辑.htaccess
。
兼:
我的文件.htaccess
运行在服务器这样的:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
</IfModule>
更新时间:
让用另一种方法再次尝试。
-
进行更改低于
application/config.php
文件$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/Your Ci folder_name'; $config['index_page'] = ''; $config['uri_protocol'] = 'AUTO';
-
使用下面的代码使
.htaccess
文件放在根目录RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA]
注意:删除<IfModule mod_rewrite.c></IfModule>
感谢你vanloc,所以如果我明白这个权利,我可以去任何.htaccess文件,因为它无关它在哪里。但它仍然不起作用。当我查看你的文件时,它部分类似于https://www.codeigniter.com/userguide3/general/urls.html。但我不明白我将如何告诉空间哪里可以找到/application/views/index.php –
它应该有任何错误,当你加载页面? – vanloc
这是指向/index.htm,就像没有任何.htaccess文件 –
嗨,是位于public_html文件夹中的文件夹“网站”? –