Zen Cart Logo
Forums / General Questions / change /index.php?main_page=index to just /

change /index.php?main_page=index to just /

Locked

Views: 4,333

Results 1 to 16 of 16
This thread is locked. New replies are disabled.
23 Feb 2015, 9:34 PM
#1
hflsales avatar

hflsales

New Zenner

Join Date:
Mar 2009
Posts:
88
Plugin Contributions:
0

change /index.php?main_page=index to just /

On my home page, when you click the logo or the home page button on my menu, instead of just my site (https://www.mysite.com) it says mysite.com/index.php?main_page=index. How can I get rid of the index.php?main_page=index?

24 Feb 2015, 12:11 AM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: change /index.php?main_page=index to just /

What's the problem with it being there?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

24 Feb 2015, 1:37 AM
#3
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: change /index.php?main_page=index to just /

you would need to choose one of the SEO url modules available in the plugins section ( Link in Header )

Zen cart PCI compliant Hosting

24 Feb 2015, 1:49 AM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: change /index.php?main_page=index to just /

So, not necessarily if the only link to modify was the "homepage" link at the top of the browser. It could possibly be hard coded, but then any parameters that exist wouldn't be carried over. It could be that at least the main_page parameter could be omitted with proper generation of the uri using zen_href_link. It could be that the current template has incorrectly implemented the link. On a ZC 1.5.4 site that has had little modification (none to the tpl_header file) the home link goes directly to the root of the store without all the extra information.

So in that regards, I'd have to ask what is different about this template than the template_default version of the equivalent file(s).

If they choose to go the path of a uri rewriter, so be it, but doubtful it would fix the issue. May actually cause more aggrivation assuming the template is incorrectly coded.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

24 Feb 2015, 2:29 AM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: change /index.php?main_page=index to just /

hflsales:

On my home page, when you click the logo or the home page button on my menu, instead of just my site (www.mysite.com) it says mysite.com/index.php?main_page=index. How can I get rid of the index.php?main_page=index?
First, what version of Zen Cart? And what template have you installed?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

24 Feb 2015, 2:39 AM
#6
hflsales avatar

hflsales

New Zenner

Join Date:
Mar 2009
Posts:
88
Plugin Contributions:
0

Re: change /index.php?main_page=index to just /

DrByte:

First, what version of Zen Cart? And what template have you installed?

I have the newest version installed 1.5.4. The template is from zen4me called Hope. I have 2 other zencarts & when you click on the logo on the home page, it goes to mysite.com with nothing else. I guess it is the template because I turned on the classic template and it works as it should. I was just hoping there was an easy fix.

24 Feb 2015, 4:01 AM
#7
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: change /index.php?main_page=index to just /

hflsales:

I have the newest version installed 1.5.4. The template is from zen4me called Hope. I have 2 other zencarts & when you click on the logo on the home page, it goes to mysite.com with nothing else. I guess it is the template because I turned on the classic template and it works as it should. I was just hoping there was an easy fix.

I would suggest looking at the template file: includes/templates/YOUR_TEMPLATE/common/tpl_header.php as compared to includes/templates/template_default/common/tpl_header.php.

It seems that the default method of the logo link is to build it directly from base path for the site instead of by creation with zen_href_link...

That is/typically is the file that has that information; however, there is no requirement for it to be there. Would generally be a good location to start though...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

24 Feb 2015, 4:09 PM
#8
hflsales avatar

hflsales

New Zenner

Join Date:
Mar 2009
Posts:
88
Plugin Contributions:
0

Re: change /index.php?main_page=index to just /

mc12345678:

I would suggest looking at the template file: includes/templates/YOUR_TEMPLATE/common/tpl_header.php as compared to includes/templates/template_default/common/tpl_header.php.

It seems that the default method of the logo link is to build it directly from base path for the site instead of by creation with zen_href_link...

That is/typically is the file that has that information; however, there is no requirement for it to be there. Would generally be a good location to start though...

I looked at both files. They are completely different but I have no idea what to change. I guess I am stuck with it. Thanks for the help.

24 Feb 2015, 4:32 PM
#9
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: change /index.php?main_page=index to just /

hflsales:

I looked at both files. They are completely different but I have no idea what to change. I guess I am stuck with it. Thanks for the help.

Only if choose to be.

Post the contents (surrounded by CODE tags) of the file in the vicinity of where your logo link is created.

The default version uses:

HTTP_SERVER . DIR_WS_CATALOG 

As the prefix/uri for the <a href= portion.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

24 Feb 2015, 5:17 PM
#10
hflsales avatar

hflsales

New Zenner

Join Date:
Mar 2009
Posts:
88
Plugin Contributions:
0

Re: change /index.php?main_page=index to just /

I added the module Ultimate URL's and it fixed it!

24 Feb 2015, 6:29 PM
#11
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: change /index.php?main_page=index to just /

As your "theme" (template files, overrides, and other bundled changes) is a commercial product, you may wish to contact the vendor for further support if fixes / changes to the "theme" are needed.

mc12345678:

... The default version uses:

HTTP_SERVER . DIR_WS_CATALOG

> As the prefix/uri for the <a href= portion.
Updating the "theme" / template files to use "HTTP_SERVER . DIR_WS_CATALOG" instead of "zen_href_link(FILENAME_DEFAULT)" would work.**¹** This is what most templates (and Zen Cart's stock template) use when creating the home link. I would suggest altering the theme you purchased to use this instead of going down the "alternative" URLs rabbit hole (unless you have other business reasons to desire alternative URLs).**²**

In the future Zen Cart may natively support "zen_href_link(FILENAME_DEFAULT)" outputting "/" instead of "/index.php?main_page=index".**³**

> **hflsales:**
>
> I added the module Ultimate URL's and it fixed it!
Aye, the code from Ultimate URLs and CEON URI take a look at the URL and will typically handle "zen_href_link(FILENAME_DEFAULT)" by outputting either "HTTP_SERVER . DIR_WS_CATALOG" or "HTTPS_SERVER . DIR_WS_HTTPS_CATALOG" followed by the zenid parameter if needed.

Just a heads up, once you go down the "alternative" URLs rabbit hole... Make sure your theme includes canonical link support. The DEMO for the theme you mentioned appears to support. No way to know for sure if the one on your site does without a link to your site.



**NOTE 1:** There are some other places internally where Zen Cart does actually use "zen_href_link(FILENAME_DEFAULT)", which does handle certain scenarios with sessions better than "HTTP_SERVER . DIR_WS_CATALOG"... However the affected scenarios are rare.

**NOTE 2:** I do use alternative URLs on a number of Zen Cart websites, so not saying there are not good business reasons to install and use a tool such as "Ultimate URLs". I am just saying it is overkill if all you wanted to do was have the home link in the header / footer navigation omit "index.php?main_page=index" from the URL.

**NOTE 3:** Some initial changes have been committed to the Zen Cart 1.6.x development branch to accommodate "zen_href_link(FILENAME_DEFAULT)" outputting the site URL without the "index.php?main_page=index". But keep in mind those changes are not final at this time (and I would not recommend applying them to a production store unless one understands all the potential implications).

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

24 Feb 2015, 6:33 PM
#12
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: change /index.php?main_page=index to just /

hflsales:

I added the module Ultimate URL's and it fixed it!

Hopefully you recognize that today's solution may be tomorrow's problem.

I am by no means against uri rewriters and in fact believe there is a place for them, but I also know what I'll need to do when I uninstall the one I currently use on one site. But realize that to solve a single issue now every uri will be rewritten, search engines will index your pages as such (changing the "world" know address to reach things on your site). Pages are still reachable by the "old" address, but new visitors will only know the rewritten. Uri and if that is uninstalled/no longer supported at some point/kept up-to-date then to maintain search engine position, all of those will need to be rewritten again.

The address in the template was then generated using zen_href_link which is why it was "fixed", but that too was different than the default version of the uri, acceptable as it provides the same result and why I asked what the issue was with it being listed as it was.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

24 Feb 2015, 7:21 PM
#13
hflsales avatar

hflsales

New Zenner

Join Date:
Mar 2009
Posts:
88
Plugin Contributions:
0

Re: change /index.php?main_page=index to just /

lhungil:

As your "theme" (template files, overrides, and other bundled changes) is a commercial product, you may wish to contact the vendor for further support if fixes / changes to the "theme" are needed.

Updating the "theme" / template files to use "HTTP_SERVER . DIR_WS_CATALOG" instead of "zen_href_link(FILENAME_DEFAULT)" would work.¹ This is what most templates (and Zen Cart's stock template) use when creating the home link. I would suggest altering the theme you purchased to use this instead of going down the "alternative" URLs rabbit hole (unless you have other business reasons to desire alternative URLs).²

In the future Zen Cart may natively support "zen_href_link(FILENAME_DEFAULT)" outputting "/" instead of "/index.php?main_page=index".³

Aye, the code from Ultimate URLs and CEON URI take a look at the URL and will typically handle "zen_href_link(FILENAME_DEFAULT)" by outputting either "HTTP_SERVER . DIR_WS_CATALOG" or "HTTPS_SERVER . DIR_WS_HTTPS_CATALOG" followed by the zenid parameter if needed.

Just a heads up, once you go down the "alternative" URLs rabbit hole... Make sure your theme includes canonical link support. The DEMO for the theme you mentioned appears to support. No way to know for sure if the one on your site does without a link to your site.

NOTE 1: There are some other places internally where Zen Cart does actually use "zen_href_link(FILENAME_DEFAULT)", which does handle certain scenarios with sessions better than "HTTP_SERVER . DIR_WS_CATALOG"... However the affected scenarios are rare.

NOTE 2: I do use alternative URLs on a number of Zen Cart websites, so not saying there are not good business reasons to install and use a tool such as "Ultimate URLs". I am just saying it is overkill if all you wanted to do was have the home link in the header / footer navigation omit "index.php?main_page=index" from the URL.

NOTE 3: Some initial changes have been committed to the Zen Cart 1.6.x development branch to accommodate "zen_href_link(FILENAME_DEFAULT)" outputting the site URL without the "index.php?main_page=index". But keep in mind those changes are not final at this time (and I would not recommend applying them to a production store unless one understands all the potential implications).

I uninstalled the Ultimate URL's since it sounds like it isn't such a good idea. I then replaced "zen_href_link(FILENAME_DEFAULT)" to "HTTP_SERVER . DIR_WS_CATALOG" and that fixed my problem. Thank you so much!

24 Feb 2015, 7:23 PM
#14
hflsales avatar

hflsales

New Zenner

Join Date:
Mar 2009
Posts:
88
Plugin Contributions:
0

Re: change /index.php?main_page=index to just /

mc12345678:

Hopefully you recognize that today's solution may be tomorrow's problem.

I am by no means against uri rewriters and in fact believe there is a place for them, but I also know what I'll need to do when I uninstall the one I currently use on one site. But realize that to solve a single issue now every uri will be rewritten, search engines will index your pages as such (changing the "world" know address to reach things on your site). Pages are still reachable by the "old" address, but new visitors will only know the rewritten. Uri and if that is uninstalled/no longer supported at some point/kept up-to-date then to maintain search engine position, all of those will need to be rewritten again.

The address in the template was then generated using zen_href_link which is why it was "fixed", but that too was different than the default version of the uri, acceptable as it provides the same result and why I asked what the issue was with it being listed as it was.

Thank you. I uninstalled Ultimate URL's.

25 Feb 2015, 6:58 PM
#15
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: change /index.php?main_page=index to just /

mc12345678:

Hopefully you recognize that today's solution may be tomorrow's problem.

Mind if I correct you there? :-)

Hopefully you recognize that today's solution WILL be tomorrow's problem. :-(

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

25 Feb 2015, 7:04 PM
#16
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: change /index.php?main_page=index to just /

RodG:

Mind if I correct you there? :-)

Hopefully you recognize that today's solution WILL be tomorrow's problem. :-(

Cheers
RodG

In retrospect related to information identified in this thread I would agree. :) debated on stating the same but didn't have sufficient info to make that claim for this situation.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...