Link to home
Start Free TrialLog in
Avatar of sara_bellum
sara_bellumFlag for United States of America

asked on

Wordpress link to outside resources, top navigation bar

I recently installed Wordpress on my Linux server and I'm using a standard template. To add a link on the navigation bar in my Wordpress home page just below the header image, I think that adding a new page is required: in this way the new link appears in the horizontal navigation bar at the top of the page.

The Wordpress permalink for my new page looks like this: http://www.mywordpress.com/?page_id=16
But I don't need to add content - I simply need to add a link to https://site.mydomain.com/path/script.cgi
and the link needs to be in my Wordpress navigation bar.

I tried apache rewrite but this failed to make any difference:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mywordpress\.com\/?page_id=16 [NC]
RewriteRule (.*) https://site.mydomain.com/path/script.cgi [L,R=301]

Since I would only need to redirect a single page, I read in one of your archives that the file to edit is
~/wordpress/wp-content/themes/name_of_theme/page.php
so I changed this:
<?php get_header(); ?>
to
<?php if (is_page( 16 ) header("Location:/https://site.mydomain.com/path/script.cgi/")) get_header(); ?>

and now I get a blank page when I navigate to the link - the url still shows http://www.mywordpress.com/?page_id=16 but now Apache doesn't know what to look for. Let me know how to fix this thanks.
ASKER CERTIFIED SOLUTION
Avatar of tailoreddigital
tailoreddigital
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sara_bellum

ASKER

Thanks very much!! It's always such a relief to find the answer (I did make it more complicated, I have a harder time with GUIs than most :-(

Another reason I got confused was that I had first tried to put the cgi script under the same doc root as my wordpress site, to keep a consistent site url.  I have two other apache virtual hosts running cgi scripts but on the virtual host running wordpress, when my browser loads a script in the directory path configured for ExecCGI, the script is displayed as text.  

The only thing I can think of is that Apache may not recognize the ExecCGI directory path in the same way that it does on non-wordpress virtual hosts:
doc-root# ls -l
  dir css
  dir images
  dir scripts <-- ExecCGI enabled but scripts appear as text
  index.php
  robots.txt
  symbolic link to /usr/share/wordpress

That being said, you did answer my question. I'll check back tomorrow, let me know if I should open a new one thanks.
I'm glad i posted, i was really second guessing whether or not i should post.  I just felt like i must be overlooking something in the question.   I'm glad we have a solution.
Enough about my  other questions...staying focused...