CodeIgniter Forums
need help inserting a simple page link - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: need help inserting a simple page link (/showthread.php?tid=64818)

Pages: 1 2 3


need help inserting a simple page link - samdrp - 03-29-2016

Hi
New to code igniter,

We just purchased a template built with code igniter. I am trying to make the link to our blog which is on a sub domain.
I found the line in views/header.php but when I change the href to the sub domain it does not redirect but give 404 error page.

Do this also need to be changed somewhere else?

Code:
<li class="gnb"><a class="mn-stores" href="blogs"><?php echo "Blogs";?></a></li>



RE: need help inserting a simple page link - PaulD - 03-29-2016

What HTML output are you getting? What link is it trying to link to.

Goto your 'blogs' page, copy the url from the browser, then paste it into the href,

Code:
<li class="gnb"><a class="mn-stores" href="PASTE URL HERE"><?php echo "Blogs";?></a></li>

Then, echoing a text line is pointless, so change it to:

Code:
<li class="gnb"><a class="mn-stores" href="PASTE URL HERE">YOUR LINK TEXT HERE</a></li>

That should be fine, although if you have probs still then you may have HTACCESS file settings that you need to address too. Try the above first.

I am assuming this is not a dynamic link.

Hope that helps,

Paul


RE: need help inserting a simple page link - samdrp - 03-30-2016

Hi,

Thanks for the help. I have tried just pasting the link into href but not sure what you mean by YOUR LINK TEXT HERE? Do you mean the "Blogs" and leave out the echo?
I will try while I wait for your answer


RE: need help inserting a simple page link - samdrp - 03-30-2016

I tried this
<li class="gnb"><a class="mn-stores" href="http://blog.designtrades.org">"Blogs"</a></li>
but still get the 404 error page


RE: need help inserting a simple page link - PaulD - 03-30-2016

(03-30-2016, 07:18 AM)samdrp Wrote: I tried this
<li class="gnb"><a class="mn-stores" href="http://blog.designtrades.org">"Blogs"</a></li>
but still get the 404 error page

You can do that but your probably want

Quote:<li class="gnb"><a class="mn-stores" href="http://blog.designtrades.org">Blogs</a></li>

If that is not working then there is something interfering with the link. Could be javascript but more likely .htaccess

Do you have an .htaccess file and if so can you paste it here so we can have a look for you.

I am not great with .htaccess files but I will see what I can see, perhaps someone else will spot something in it.

Best wishes,

Paul.


RE: need help inserting a simple page link - samdrp - 03-30-2016

Hi Paul

I also tried your suggestion but same error.
I have the htaccess but I have never seen one with only this info. Normally I have seen much more in htaccess files.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|javascript|images|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]


RE: need help inserting a simple page link - arma7x - 03-30-2016

http://blog.designtrades.org/ is reachable. If you click button Blog, what is the URL that redirect you to 404 error page


RE: need help inserting a simple page link - samdrp - 03-30-2016

(03-30-2016, 11:48 AM)arma7x Wrote: http://blog.designtrades.org/ is reachable. If you click button Blog, what is the URL that redirect you to 404 error page

it is trying to go to design trades.org/blog


RE: need help inserting a simple page link - PaulD - 03-30-2016

(03-30-2016, 11:27 AM)samdrp Wrote: Hi Paul

I also tried your suggestion but same error.
I have the htaccess but I have never seen one with only this info. Normally I have seen much more in htaccess files.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|javascript|images|robots\.txt)
RewriteRule ^(.*)$ /index.php?/$1 [L]

Again, not an expert on .htaccess by a long way, but you could try adding this line just before your RewriteRule

Code:
RewriteCond %{HTTP_HOST} !=blog.designtrades.org [NC]

I may be entirely wrong of course, the link is directly available as pointed out. Are you updating the live site www.designtrades.org with the changes? Or are you on a development machine or working locally?

Your current link is still
Code:
<li class="gnb"><a class="mn-stores" href="blogs">Blogs</a></li>

but it should be
Code:
<li class="gnb"><a class="mn-stores" href="http://blog.designtrades.org">Blogs</a></li>

If you are working live, fix that first, if it still does not work, then you can try the htaccess thing.

Let us know how you get on,

Best wishes,

Paul

PS When it comes to .htaccess it often takes me hours of fiddling and retrying and reading the docs and trying again. I customise .htaccess files so infrequently that the meaning of the rules always escapes me. I finally got the index.php to dissappear on my CI installs (thanks to some funny stuff from my host) that I now just re-use the same one again and again.


RE: need help inserting a simple page link - arma7x - 03-30-2016

I visit http://blog.designtrades.org and click Blog, it redirect me to http://blog.designtrades.org/blog. I also visit http://designtrades.org but no Blog link found using ucweb mobile browser