Nizam Ahammad
Nizam Ahammad

Reputation: 55

CodeIgniter URL mod_rewrite

I am trying to study codeigniter. I am confused with URL mod_rewrite. I use 2 pages: home.php and about.php in view directory, and call them using controller Site. In both the pages i gave links for it with controller functions home, about respectively:

< a href='home'>Home</a>
< a href='about'>About</a>

when I type the URL as localhost/Project/Site/home and localhost/Project/Site/about it works efficiently. My problem is when I call the URL "localhost/Project" I can get the home.php but after that if I click on any links (Home / About ), the url will be localhost/Project/home and can not access the page.

I am using .htaccess as the direction in the YouTube video

It may be a simple issue but i can't solve it. Please help me.

Upvotes: 0

Views: 63

Answers (1)

dm03514
dm03514

Reputation: 55932

prepending the path with a slash will make it link from your root url

I would just give it the path that works, something like:

< a href='/Project/site/home'>Home</a> < a href='/Project/site/about'>About</a>

right now it appends to the current url, as you see what is happening

Upvotes: 1

Related Questions