Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Remove index.php when browsing back to main page


Guest

Recommended Posts

One of the suggestion I received for my site was to remove the index.php from "continue" buttons and the breadcrumb trail so when you return to the main page it is www.yoursite/ instead of www.yoursite/index.php. This was suggested for SEO reasons.

 

To do this go to catalog/includes/filesnames.php and add;

 

  define('FILENAME_HOME', '/');

 

CONTINUE BUTTON

 

To change the buttons search your site for;

 

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>

 

And replace with;

 

<?php echo '<a href="' . tep_href_link(FILENAME_HOME) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>

 

The only change being DEFAULT changed to HOME. There are not many instances of this so it is easy to do, I found none in the admin side so a site search and replace should be okay. :-"

 

BREADCRUMB TRAIL

 

To change the breadcrumb trail open catalog/includes/application.top and find;

 

  //$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
 $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

 

And replace with;

 

  //$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
 $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_HOME));

 

That's all. This will take the file index.php out of your file names and so all pages will link back to your main domain (www.yoursite.com/) and avoid any chance of SE's seeing it as duplicate page content.

 

Thanks to misterbling for the tip, much appreciated.

 

Peter

Link to comment
Share on other sites

  • Replies 80
  • Created
  • Last Reply
<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>

 

In which file can I find above line?

Link to comment
Share on other sites

In which file can I find above line?

 

If you have a good PHP editor you should be able to search for it. My site is very modified so I can't tell you for sure what pages it is on.

 

Try;

shopping_cart.php

logoff.php

gv_redeem.php

cookie_usage.php

 

and maybe the info box pages

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the great tip

 

 

I have a quick q though

 

i have implemented this so that when i click on the stores logo it does the same and it does work however it gives

 

www. mydomain.co.uk//

 

i have tried changing the code

define('FILENAME_HOME', '/');

to

define('FILENAME_HOME', '');

 

but that throws up an error?!

 

any ideas?

 

thanks again

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

www. mydomain.co.uk//

 

Now my site reads http//:mysite.com//

Is that right? 2(//) on the end?

 

 

It is probably caused by a variation between our configure.php files.

Link to comment
Share on other sites

So.... , it shouldn't be this way?

With the two ( // ).

Thanks,

Moon

 

i cant get this to stop it,

 

i have compared the two config files and there is nothing obvious,

 

any suggestions?

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

Yeh, me to...

I compared the two myself, don't see a difference.

Oddly enough I installed Ultimate SEO url's and now all works fine.

The double / / is gone...Go figure!

Moon

"Woohoo, Just Havin Funnn!"

Link to comment
Share on other sites

thanks to help from java roasters and yesudo, this now works with

 

 

in includes/functions/html_output.php change:

 

if ($connection == 'NONSSL') {
     $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
   } elseif ($connection == 'SSL') {
     if (ENABLE_SSL == true) {
       $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
     } else {
       $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
     }
   } else {
     die('</td></tr></table></td></tr></table><br><br><font 
color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine 
connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');
   }

To:

 

if($page = '/')
   {
     if ($connection == 'NONSSL') {
       $link = HTTP_SERVER;
     } elseif ($connection == 'SSL') {
       if (ENABLE_SSL == true) {
         $link = HTTPS_SERVER;
       } else {
         $link = HTTP_SERVER;
       }
     } else {
       die('</td></tr></table></td></tr></table><br><br><font 
color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine 
connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');
     }
   }
   else
   {
     if ($connection == 'NONSSL') {
       $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
     } elseif ($connection == 'SSL') {
       if (ENABLE_SSL == true) {
         $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
       } else {
         $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
       }
     } else {
       die('</td></tr></table></td></tr></table><br><br><font 
color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine 
connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');
     }
   }

 

This will allow tep_href_link to work with FILENAME_HOME without duplicating

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

  • 3 weeks later...

Just an FYI;

 

Anyone usine a "browse by categories" type of contribution in the sub you might have a link back to index.php

 

Also The manufacturers box has reference to index.php

 

Also the header image by default might be a link to index.php

 

IMPORTANT to remove all index.php if we're going this route. I really bungled my site but will be ok the next PR update due to this. ie;

 

http://www.misterbling.com PR2

/index.php PR2

 

Should have been

http://www.misterbling.com PR4

/index.php PR0

 

How can I be sure you say? Every link from my homepage of PR2 is a PR 3 LOL. My sitemap is a PR 3, My products are even higher or the same PR as the homepage. Seem I shot myself in the foot because I didn't seek out all the index.php references.

 

Any other index.php's found please let me know.

 

tool to find out;

 

http://www.gritechnologies.com/

 

tool with PR results; (use google option)

 

http://mesoimpact.com/spider/

Link to comment
Share on other sites

  • 2 weeks later...
One of the suggestion I received for my site was to remove the index.php from "continue" buttons and the breadcrumb trail so when you return to the main page it is www.yoursite/ instead of www.yoursite/index.php.? This was suggested for SEO reasons.

 

To do this go to catalog/includes/filesnames.php and add;

 

 ?define('FILENAME_HOME', '/');

 

CONTINUE BUTTON

 

To change the buttons search your site for;

 

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>

 

And replace with;

 

<?php echo '<a href="' . tep_href_link(FILENAME_HOME) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>

 

The only change being DEFAULT changed to HOME.? There are not many instances of this so it is easy to do, I found none in the admin side so a site search and replace should be okay.?  :-"

 

BREADCRUMB TRAIL

 

To change the breadcrumb trail open catalog/includes/application.top and find;

 

 ?//$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
?$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

 

And replace with;

 

 ?//$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
?$breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_HOME));

 

That's all.? This will take the file index.php out of your file names and so all pages will link back to your main domain (www.yoursite.com/) and avoid any chance of SE's seeing it as duplicate page content.

 

Thanks to misterbling for the tip, much appreciated.

 

Peter

 

Is there any reason why you cant just change FILENAME_DEFAULT to

define('FILENAME_DEFAULT', '/');

 

Just wondering as it seems a little easier...

Link to comment
Share on other sites

Hello

 

Great tip and it works great for me so far, but i have a small problem

 

when i change the cont button it goes from

 

/index.php?osCAdminID=9913d3649e6dc910e9ee2d37269a6af4

 

to

 

/?osCAdminID=9913d3649e6dc910e9ee2d37269a6af4

 

is it possible to remove the ?oscAdmin part or im i stuck with this ?

 

 

Kind regards

Link to comment
Share on other sites

Sorry me again

 

 

I sorted the above part out just by removing the numbers and osc bit, looks like it works ok,

 

but one more little thing.

 

in the catagories box when clicked opens a page Eg baby shoes

 

co.uk/index.php?cName=baby-shoes came up

 

when i changed the DEFAULT to HOME the index.php went but so did the baby shoes bit and i was left with numbers EG 21-28

 

I have installed Chemos Ultimate so not sure what else i would need to change for this to remove the index.php part but keep my baby shoes bit.

 

 

Kind regards

Link to comment
Share on other sites

  • 2 months later...

Thanks for the tips, work great. The only thing missing was to change the link when you click on the logo for the site which you can do in includes/header.php

 

find around line 57

 

<a href="' . tep_href_link(FILENAME_DEFAULT) . '">

 

and replace with

 

<a href="' . tep_href_link(FILENAME_HOME) . '">

 

cheers

 

stubbsy

Link to comment
Share on other sites

  • 3 weeks later...

I am getting the double /.

However when I change code in html_output.php I get parse error?

Just wondering if anybody else having same problem?

 

Other than that this works great, was wanting this on my website.

Thanks to all for this.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

How do you do a site search and replace?

 

One of the suggestion I received for my site was to remove the index.php from "continue" buttons and the breadcrumb trail so when you return to the main page it is www.yoursite/ instead of www.yoursite/index.php. This was suggested for SEO reasons.

 

To do this go to catalog/includes/filesnames.php and add;

 

  define('FILENAME_HOME', '/');

 

CONTINUE BUTTON

 

To change the buttons search your site for;

 

<?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>

 

And replace with;

 

<?php echo '<a href="' . tep_href_link(FILENAME_HOME) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?>

 

The only change being DEFAULT changed to HOME. There are not many instances of this so it is easy to do, I found none in the admin side so a site search and replace should be okay. :-"

 

BREADCRUMB TRAIL

 

To change the breadcrumb trail open c

 

 

atalog/includes/application.top and find;

 

  //$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
 $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

 

And replace with;

 

  //$breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
 $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_HOME));

 

That's all. This will take the file index.php out of your file names and so all pages will link back to your main domain (www.yoursite.com/) and avoid any chance of SE's seeing it as duplicate page content.

 

Thanks to misterbling for the tip, much appreciated.

 

Peter

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...

I'm having trouble removing all index.php's. Can someone tell me what the risk is of having them reference? Thanks, I know it's probably a stupid ?

 

It is for the search engines as they see www.yourdomain.com/ and www.yourdomain.com/index.php as two seperate pages both with identical content. This will cause them to split your Page Rank between the two pages or maybe even penalize you a bit for having identical pages. So if you remove all links to index.php then you are left with just one page and that should give you better Search Engine placement.

 

HTH

Link to comment
Share on other sites

i take it this edit doesn't work well with certain url rewrite contributions? :) i use nimmit's and i experienced the problem 2 posts up, but it seems to work fine on your site java roasters

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...