sweetafton Posted January 3, 2006 Share Posted January 3, 2006 the main page of my website is http://mysite.com/catalog. i can go to http://www.mysite.com/catalog. but when i click any other page eg prudct page the www will gone. and there is another problem. that is when i browse http://www.mysite.com it appears 404 error. looks like http://mysite.com/catalog because my home page. there are two things i don't know what to do . first i want make http://www.mysite.com for my homepage not http://mysite.com/catalog. second i want my site just looks like most others have the www in font when browsing. now like http://mysite.com........at the moment. can anyone tell me what should i do please. i am using web host . with unix system.php 4. Link to comment Share on other sites More sharing options...
Guest Posted January 6, 2006 Share Posted January 6, 2006 the main page of my website is http://mysite.com/catalog. i can go to http://www.mysite.com/catalog. but when i click any other page eg prudct page the www will gone. and there is another problem. that is when i browse http://www.mysite.com it appears 404 error. looks like http://mysite.com/catalog because my home page. there are two things i don't know what to do . first i want make http://www.mysite.com for my homepage not http://mysite.com/catalog. second i want my site just looks like most others have the www in font when browsing. now like http://mysite.com........at the moment. can anyone tell me what should i do please. i am using web host . with unix system.php 4. These are all things for your configure.php files and don't have much to do with this thread. You have to just move all the files to your root directory. If you have an FTP program it is quite easy just make a backup first and check the backup to make sure it is valid. After that just remove the "catalog" refrences in your 2 configure.php files. As for the www part in your URL's that is also part of you configure.php files. You have a section that says; define('HTTP_SERVER', 'http://www.mydomain.com'); // define('HTTPS_SERVER', 'https://www.mydomain.com'); // The 404 error will go away when you move your site to the root directory. make sure you have added the www there. There are MANY threads on moving your shop to the root directory and also on configure.php files if you get stuck or need more info 'search" will find the answers for you. Peter Link to comment Share on other sites More sharing options...
Kenja Posted April 14, 2006 Share Posted April 14, 2006 I thought of a much cleaner way of implementing this functionality. You won't have to worry about searching your site and changing all the FILENAME_DEFAULT instances to FILENAME_HOME. In fact, you don't have to define FILENAME_HOME. Also you don't have to be anal about checking all new contribs for FILENAME_DEFAULT. Go to catalog/includes/functions/html_output.php and 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 == FILENAME_DEFAULT && $parameters=='') //traps all references to index.php made without any passed parameters like cPath, etc... { $page == '/'; //Changes the path from 'index.php' to '/' 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>'); } } Now it will elminate http://www.mystore.com/index.php for good. Link to comment Share on other sites More sharing options...
Kenja Posted April 14, 2006 Share Posted April 14, 2006 Sorry to post buggy code, but I just realized I have a mistake in the code above. Change $page == '/'; to $page='/'; when you make the changes. Also, my solution currently doesn't solve the breadcrumb issue automatically (you still have to do that manually), but I should be able to come up with something similar for that. Will post when I've finished it. Ken Link to comment Share on other sites More sharing options...
Kenja Posted April 15, 2006 Share Posted April 15, 2006 Here's how you fix the breadcrumb problem all in one place. In catalog/includes/classes/breadcrumb.php, change: function add($title, $link = '') { $this->_trail[] = array('title' => $title, 'link' => $link); } To: function add($title, $link = '') { if($link==FILENAME_DEFAULT){ $link=HTTP_SERVER."/"; } $this->_trail[] = array('title' => $title, 'link' => $link); } Now that all that is finished, I want to automatically redirect anybody (including search engines) that tries to go to index.php with no parameters to the base URL. Any redirect gurus out there that want to help me figure that one out? Link to comment Share on other sites More sharing options...
matrix2223 Posted April 28, 2006 Share Posted April 28, 2006 The above code does not work for me Sounds good but dont work Link to comment Share on other sites More sharing options...
Kenja Posted April 28, 2006 Share Posted April 28, 2006 The above code does not work for me Sounds good but dont work Hi. I can try to help, but you'll have to define what "doesn't work" means exactly. Did you implement one or both modifications? What happens when you do it? Link to comment Share on other sites More sharing options...
Kenja Posted April 28, 2006 Share Posted April 28, 2006 Also, to answer my other question above, here are the modifications I used to redirect visitors who come to www.mysite.com/index.php to www.mysite.com/ That will keep the search engines happy that already have index.php in their databases. It ignores index.php calls with parameters, so make sure you install the spider sessions mod and keep it up to date. The other part of the code redirects people who come to http://mysite.com to http://www.mysite.com That should resolve all the issues. <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^www\.mysite\.com RewriteRule ^(.*)$ http://www.mysite.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://www.mysite.com/ [R=301,L] </IfModule> Link to comment Share on other sites More sharing options...
matrix2223 Posted April 28, 2006 Share Posted April 28, 2006 Im sorry but it does work silly me put it in the admin side and with my site the breadcrumbs are change without going to the breadcrumbs.php hey works for me thanks for the help Link to comment Share on other sites More sharing options...
morganhoff Posted June 16, 2006 Share Posted June 16, 2006 Is there any reason why you cant just change FILENAME_DEFAULT to define('FILENAME_DEFAULT', '/'); Just wondering as it seems a little easier... Makes sense to me, but did anyone try this? Does anyone have any suggestions why this would be a bad idea? Link to comment Share on other sites More sharing options...
Guest Posted June 16, 2006 Share Posted June 16, 2006 i'm pretty sure certain modules of osc requiree index.php in this fashion: index.php?page=2 or something along those lines but of course trial and error is the best way to see if it works or not :) Link to comment Share on other sites More sharing options...
sefu Posted June 18, 2006 Share Posted June 18, 2006 I didnt see this post so I posted a similar question in the support section. I got a reply and was quoted to do the following which is working for me, its for the bread crumb only though filename.php $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER); $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link('')); comment out the following in html_output.php if (!tep_not_null($page)) { die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>'); } Link to comment Share on other sites More sharing options...
jlknauff Posted June 26, 2006 Share Posted June 26, 2006 Ahhh...been looking for this! Link to comment Share on other sites More sharing options...
matrix2223 Posted September 12, 2006 Share Posted September 12, 2006 I thought of a much cleaner way of implementing this functionality. You won't have to worry about searching your site and changing all the FILENAME_DEFAULT instances to FILENAME_HOME. In fact, you don't have to define FILENAME_HOME. Also you don't have to be anal about checking all new contribs for FILENAME_DEFAULT. Go to catalog/includes/functions/html_output.php and 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 == FILENAME_DEFAULT && $parameters=='') //traps all references to index.php made without any passed parameters like cPath, etc... { $page == '/'; //Changes the path from 'index.php' to '/' 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>'); } } Now it will elminate http://www.mystore.com/index.php for good. Has anyone ever had any problems at all with this code yet? Just asking, I had in before in my store mut moved hosts and never got around to permenitly adding it. Thanks, Eric Link to comment Share on other sites More sharing options...
Kenja Posted September 12, 2006 Share Posted September 12, 2006 I use it on my site and have been happy with it so far. I did make and correct a typo, so as long as you see that, it will work fine. Link to comment Share on other sites More sharing options...
matrix2223 Posted September 14, 2006 Share Posted September 14, 2006 I use it on my site and have been happy with it so far. I did make and correct a typo, so as long as you see that, it will work fine. Hi Kenja, I changed the code as you refered to with the typo fix. Nothing happened to any FILENAME_DEFAULT links that I have within my site. They still go to index.php. any ideas, I also have chemos Ultimate SEO URL contrib added. Heres the link My Webpage Thanks a bunch, Eric Link to comment Share on other sites More sharing options...
Kenja Posted September 15, 2006 Share Posted September 15, 2006 Based on your earlier post it seems that you had it working before. I'm not sure why it isn't working now. I also use the Ultimate SEO URLs contribution. Did you do the change in the catalog directory? catalog/includes/functions/html_output.php I'd add the following debug code (see between //Begin Debug and //End Debug). if($page == FILENAME_DEFAULT && $parameters=='') //traps all references to index.php made without any passed parameters like cPath, etc... { $page = '/'; //Changes the path from 'index.php' to '/' //begin debug echo "Got here"; //end debug if ($connection == 'NONSSL') { $link = HTTP_SERVER; } elseif ($connection == 'SSL') { if (ENABLE_SSL == true) { $link = HTTPS_SERVER; } else { $link = HTTP_SERVER; } If the debug statement is reached, I believe it will choke with an error message saying HTML headers have already been sent or something like that. If so, that means you are reaching the code. If not and if the "got here" doesn't appear on the page, you're not reaching the code. If you aren't reaching the code, then try changing: if($page == FILENAME_DEFAULT && $parameters=='') to if($page == FILENAME_DEFAULT) as a test. Be sure to change it back when done testing. Then if that starts throwing the error or you see the "got here" code, you may have some parameters being passed. That function is called whenever tep_href_link() is called, so I'm not sure why it wouldn't be working for you. Link to comment Share on other sites More sharing options...
cannuck1964 Posted September 15, 2006 Share Posted September 15, 2006 Here is my htaccess file, it does the front end: cheers and HTH someone: # This is used with Apache WebServers # # For this to work, you must include the parameter 'Options' to # the AllowOverride configuration # # Example: # # <Directory "/usr/local/apache/htdocs"> # AllowOverride Options # </Directory> # # 'All' with also work. (This configuration is in the # apache/conf/httpd.conf file) # The following makes adjustments to the SSL protocol for Internet # Explorer browsers <IfModule mod_php5.c> php_flag register_long_arrays on </IfModule> <IfModule mod_setenvif.c> <IfDefine SSL> SetEnvIf User-Agent ".*MSIE.*" \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 </IfDefine> </IfModule> # If Search Engine Friendly URLs do not work, try enabling the # following Apache configuration parameter # # AcceptPathInfo On # Fix certain PHP values # (commented out by default to prevent errors occuring on certain # servers) <IfModule mod_php4.c> php_value session.use_trans_sid 0 php_value register_globals 1 php_flag display_errors On php_flag track_errors On </IfModule> Options +FollowSymLinks RewriteEngine On RewriteBase / # Eliminates www vs. non-www RewriteCond %{HTTP_HOST} ^domain\.com RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L] # Eliminates duplicate home page i.e.: www.domain.com/index.php and www.domain.com appear as duplicate home page RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://www.domain.com/ [R=301,L] # Skip the next two rewriterules if NOT a spider RewriteCond %{HTTP_USER_AGENT}!(msnbot?slurp?googlebot) [NC] RewriteRule .* - [S=2] # case: leading and trailing parameters RewriteCond %{QUERY_STRING} ^(.+)&osCSid=[0-9a-z]+&(.+)$ [NC] RewriteRule (.*) $1?%1&%2 [R=301,L] # # case: leading-only, trailing-only or no additional parameters RewriteCond %{QUERY_STRING} ^(.+)&osCSid=[0-9a-z]+$?^osCSid=[0-9a-z]+&?(.*)$ [NC] RewriteRule (.*) $1?%1 [R=301,L] cheers, Peter M Peter McGrath ----------------------------- See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation Link to comment Share on other sites More sharing options...
matrix2223 Posted September 15, 2006 Share Posted September 15, 2006 Thanks Kenja for replying, The post I had earlier was for a different site, and it did work instantly. I dont have time right now but will make the changes in a few hours and post back with an update. Im not so sure about using the .htaccess bit being that I have already added stuff to it. Ill put that on the back burner for the moment. Thanks, Eric Link to comment Share on other sites More sharing options...
cannuck1964 Posted September 16, 2006 Share Posted September 16, 2006 Im not so sure about using the .htaccess bit being that I have already added stuff to it. Ill put that on the back burner for the moment.The htaccess file I posted really does url rewriting. If you have SEO urls installed, the rewrite rules would need to be changed. but generally by replacing the http://www.domain.com/ to have your info and the other areas where you would see that info. This works well as it also tells the search engine it is a permant move (301). Have questions, I might be able to help some if anyone is interested.... cheers, peter M Peter McGrath ----------------------------- See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation Link to comment Share on other sites More sharing options...
matrix2223 Posted September 16, 2006 Share Posted September 16, 2006 I have just decided to go through and manually change all instances of FILENAME_DEFAULT to '/' so it removes the index.php bit. I know its a lot more work but I have already alot of time in this site. Thank you to all of you have replied. Eric Link to comment Share on other sites More sharing options...
motorcity Posted November 20, 2006 Share Posted November 20, 2006 Okay I made this mod following the java roaster method with no problems. It brings up a question however. I can still type in domain/index.php and go straight to the main page so what about the search engines who might be looking for it? Should I do a redirect? So if you do go to index.php you get redirected to / Thanks for any insights here. Link to comment Share on other sites More sharing options...
motorcity Posted November 21, 2006 Share Posted November 21, 2006 Still hoping someone with some experience would respond to my basic concern here. Everything about this seems to work except: If I can still type in http://www.fdsons.com/index.php and go straight to the same main page as http://www.fdsons.com/ ...... why can't the search engines do the same thing? I tried adding a redirect in the .htaccess like: Redirect permanent /index.php http://www.fdsons.com/ but that killed the whole website. I've read through this thread numorous times, it appears the original poster java roaster & misterbling are saying this works without doing anything more to index.php IS THAT RIGHT??? For anyone else trying to do this I'll add to Java Roaster's list of files to check/change: shopping_cart.php logoff.php gv_redeem.php cookie_usage.php -My additions- about_us.php shipping.php all_products.php (cloned about_us pages of ours, check yours) services.php & overview.php privacy.php conditions.php redirect.php login.php create_account_success.php checkout_success.php Thanks :blink: Link to comment Share on other sites More sharing options...
matrix2223 Posted November 21, 2006 Share Posted November 21, 2006 You basically have to change the code for the back button on all pages that has the link to (FILENAME_DEFAULT) to ('/'). The idea behind this is to get rid of the index.php page and the need for a redirect. Supposidly both are bad from an SEO stand point. Havin the index.php says a duplicate page content, and a redict just looks bad altogether for either a temporary or permenate. If you need help locating the files and code to change this im me or post back here. I will be glad to help you. Eric Link to comment Share on other sites More sharing options...
motorcity Posted November 21, 2006 Share Posted November 21, 2006 Eric The method I used was what was originally posted by java roast to change all ocurrances of(FILENAME_DEFAULT) to (FILENAME_HOME) and add define('FILENAME_HOME', '/'); to the /includes/filesnames.php I listed every single file I changed in my previous post. It works fine, I can click away all day from my site and never get directed to http:mydomain/index.php (or at least it is never displayed as such). My question is if I can still type it in to a browser and go to mysite/index.php why would a search engine not still see it as a duplicate? Does it just fade away after time because nobody but the search engine remembers it? If Java roaster & misterbling are using a .htaccess redirect like cannuck1964 wrote about, they never mentioned it here. Are you planning on anything else Eric? Your site does the same thing index.php just your .com Maybe its no big deal but I'd sure like to hear something more about it. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.