我安装了 codeigniter 并开始在上面编写一些代码。首先我想删除 index.php 并对其进行一些研究。我用下面的一个小 htaccess 代码将其删除,
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ /pasaj/index.php/$1 [L]
然后在 config.php 中将我的 base_url 设置为,
$config['base_url'] = 'http://localhost/pasaj/';
然后我决定在表单的操作中使用 base_url
并这样写(请看动作)
<form method="post" id="formSubmit" name="fSubmit" action=<?php base_url(); ?>"kayit/kayitOnay/">
但没用
and prints url like that
我所做的一切都不起作用
我怀疑是从我的 htaccess 文件中删除的。我用它来删除 codeigniter 默认中的 index.php 。
并设置我的新
基本网址一定是这样的
http://localhost/pasaj/index.php/
并且不要更改表单代码以上的任何内容
它有效。
现在,我想仍然使用这个 htaccess 文件来删除index.php,但是当 htaccess 文件存在时,我的 base_url 工作错误。 htaccess 文件可能发生哪些变化?
try this
RewriteEngine on
RewriteBase /pasaj/
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
我在本地服务器上的 htaccess 文件如下所示:
对于 Zend Framework Web:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
对于 CodeIgniter 网络:
RewriteEngine on
RewriteBase /pasaj/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)