CodeIgniter Forums
anchorlinks not working on live site - 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: anchorlinks not working on live site (/showthread.php?tid=18396)

Pages: 1 2


anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]learning_php[/eluser]
Hi,

I have put my site live but none of the links seem to be working? and i cannot navigate away from the home page?

I link to other pages like so:
Code:
<li>&lt;?= anchor('info','Information');?&gt;</li>
any suggestions?


anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]Dam1an[/eluser]
Have you changed the base_url in your config file?
Whats the link it generates? (view source or what appearce in the status bar when you hover over the link)


anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]learning_php[/eluser]
I changed the base url to
Code:
$config['base_url']    = 'http://www.wesayido.co.uk/';
The page souce code is
Code:
<li><a href="http://www.wesayido.co.uk/info">Information</a></li>
and when i hover over
Code:
http://www.wesayido.co.uk/info



anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]Dam1an[/eluser]
Hmm... Seeing as the links are rendered correctly, and assuming they're clickable and the page reloads, I'd be tempted to say its something with you .htaccess file perhaps?
Maybe try renaming that (so it doesn't execute) and try a URL (including the index.php)


anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]TheFuzzy0ne[/eluser]
Try changing uri_protocol in config.php to REQUEST_URI or QUERY_STRING.

If that doesn't work, please post you're htaccess file and any routes you might have.


anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]learning_php[/eluser]
when i change it to a REQUEST_URI i get a 404 error?

here is my .htaccess
Code:
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /http://www.wesayido.co.uk/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php/$1 [QSA,NC,L]
</IfModule>

<IfModule !mod_rewrite.c>
  # If we don’t have mod_rewrite installed, all 404’s
  # can be sent to index.php, and everything works as normal.

  ErrorDocument 404 /index.php
</IfModule>

and my routes
Code:
$route['default_controller'] = "homepage";
$route[''] = "homepage";
$route['info'] = "www.wesayido.co.uk/Homepage/info";
$route['Gifts'] = "Homepage/gifts";
$route['gallery'] = "gallery/gallery";
$route['gallery'] = "gallery/index";
$route['register'] = "homepage/register";
$route['Church'] = "direction/direction";
$route['JockeyClub'] = "direction1/direction1";
$route['images'] = "dashboard";



anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]rogierb[/eluser]
why use RewriteBase /http://www.wesayido.co.uk/?
RewriteBase / should be enough since you want to route to the root


anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]learning_php[/eluser]
i have changed that line now this one works
Code:
$route['gallery'] = "gallery/index";
but i get 404 errors on the rest?


anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]learning_php[/eluser]
hi,

just reuploaded the routes file to the server and all seems to be working.

Thanks for all your help


anchorlinks not working on live site - El Forum - 05-05-2009

[eluser]CroNiX[/eluser]
I had this problem as well. I found the problem was in the htaccess and using your line:
RewriteRule ^(.*)$ /index.php/$1 [QSA,NC,L]

I had to change mine to:
RewriteRule ^(.*)$ /index.php?/$1 [QSA,NC,L]
Adding the (?) after index.php

Not sure why....but it fixed it and maybe it will work for you too.