简体   繁体   English

Codeigniter锚不起作用

[英]Codeigniter Anchor not working

I am using Windows 7 to develop on. 我正在使用Windows 7进行开发。

I am having trouble with my anchors in codeigniter. 我在codeigniter中遇到锚问题。 I get an error. 我得到一个错误。

The requested URL /mysite/contact was not found on this server.

If i add index.php to my anchor it works. 如果我将index.php添加到我的锚中,它将起作用。

<?php echo anchor('index.php/contact', 'Contact Us', 'title="Contact"');?>

If I remove the index.php part then I get the above error. 如果删除index.php部分,则会收到上述错误。

I am using WAMP have rewrite module enabled. 我正在使用WAMP启用了重写模块。 In my config I have the following. 在我的配置中,我有以下内容。

$config['base_url'] = 'http://localhost/mysite';

And

$config['index_page'] = '';

And lastly here is my .haccess I am using 最后这是我正在使用的.haccess

RewriteEngine on
RewriteCond $1 !^(index\.php|images|captcha|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I figured it out. 我想到了。 I had the .htaccess file in my application folder and not at the root of the site. 我的应用程序文件夹中有.htaccess文件,而不是网站的根目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM