Welcome Guest, Not a member yet? Register   Sign In
Problem with anchor() after rewriting URLs
#1

[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
#2

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

[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.
#4

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




Theme © iAndrew 2016 - Forum software by © MyBB