CodeIgniter Forums
Problem with anchor() after rewriting URLs - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Problem with anchor() after rewriting URLs (/showthread.php?tid=4859)



Problem with anchor() after rewriting URLs - El Forum - 12-19-2007

[eluser]rohanprabhu[/eluser]
I began development on a website using the URL format:

http://www.example.com/index.php/class/function

In this site, I commonly use anchor() and site_url() to generate Links and/or URLs to point to a particular controller class like:

Code:
anchor("mypage");

Now, the link this code creates points to:

Quote:http://www.example.com/index.php/mypage

After deployment, I used an .htaccess files to get rid of the 'index.php' part in the URL address. I used the .htaccess file shown here

But, now, when I reach a page like http://www.example.com or even http://example.com/yourpage the anchor("mypage"); line still generates a link with 'index.php' in it. I rather want it to generate something like: http://www.example.com/mypage.

How do I configure CodeIgniter so that anchor() preps the links without the 'index.php' in it.

Thanks


Problem with anchor() after rewriting URLs - El Forum - 12-19-2007

[eluser]Armchair Samurai[/eluser]
Sounds like you need to edit your config.php file, specifically set the index page to an empty string.


Problem with anchor() after rewriting URLs - El Forum - 12-19-2007

[eluser]nirbhab[/eluser]
Hi

Please check your config.php file under directory:
[system\application\config]
Code:
$config['index_page'] = "index.php";

Change it to:
Code:
$config['index_page'] = "";

Than try using your application.


Problem with anchor() after rewriting URLs - El Forum - 12-20-2007

[eluser]rohanprabhu[/eluser]
thanks a lot guys.. my problems solved Big Grin