View Single Post
  #45  
Old 01-20-2006, 08:35 AM
  moneysaver67's Avatar 
moneysaver67 moneysaver67 is offline
 

Advanced Member
  
Join Date: Nov 2005
Posts: 74
 

Default Out-of-the-box solution all from various posts in this topic

Well, after reading through the currently 3 pages of posts on this topic, I thought I'd share what we have done by throwing in our two-bits:

I found this example on page 1, but the output was not as one may desire (with our service provider, at least). Changing to the following took care of displaying w/o a splash and correcting necessary links:

Root index.php File
Code:
<?php //This part takes the html from your front page and turns it into a string. // Replace 'shop' with your x-cart directory. // This mod allowed for proper evaluation of the PHP code on our server. // Prior example worked, but simply output the PHP-skeleton, if you will. $contents = file_get_contents("http://".$_SERVER[SERVER_NAME]."/shop/home.php"); //These functions change the paths of most x-cart related links to their // original locations. Change 'shop' to your x-cart directory name. $contents = ereg_replace("home.php","shop/home.php",$contents); $contents = ereg_replace("product.php","shop/product.php",$contents); $contents = ereg_replace("help.php","shop/help.php",$contents); $contents = ereg_replace("search.php","shop/search.php",$contents); $contents = ereg_replace("cart.php","shop/cart.php",$contents); $contents = ereg_replace("register.php","shop/register.php",$contents); $contents = ereg_replace("pages.php","shop/pages.php",$contents); //This spits out your the html code and the browser does the rest. echo $contents; ?>


Here's an example of our .htaccess file in our root directory. This RewriteEngine suggestion seemed to make perfect sense. In summary, this forces a standard-format version of your domain for help with Google PageRank, etc.
[list=1][*]Resolves http://IP_ADDRESS_HERE to standard URL format[*]Resolves http://DOMAIN_NAME.COM to standard URL format (with www)[*]Resolves http://www.yOuR_doMAin_naMe.coM to standard URL format (converts to proper-case, custom defined)[*]Resolves common ErrorDocuments 400,403, and 404 to root of your site.
  1. e.g. http://www.shop.com/pageDoesNotExist.html
[/list:0b28671784]

In summary, any of the aforementioned link examples ALL resolve back to the root. The benefit of this method is that the first code posted above returns an HTTP Response of 200, which is common and treated just fine by SE indexing bots. As for the link examples using RewriteEngine, they redirect using the Search Engine Friendly 301 Response (Permanent Redirect)

* You can validate all of this via links referenced throughout this topic.

And now, onto the code!

Root .htaccess file
Code:
# REWRITE RULES Options +SymlinksIfOwnerMatch -Indexes <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^www\.home-rehab-supply\.com [NC] RewriteRule ^(.*)$ http://www.home-rehab-supply.com/$1 [R=301,L] </IfModule> ErrorDocument 400 http://www.home-rehab-supply.com ErrorDocument 403 http://www.home-rehab-supply.com ErrorDocument 404 http://www.home-rehab-supply.com

From: http://forum.x-cart.com/viewtopic.php?t=25757

Last but not least...

With our version of X-Cart 4.0.16 Gold (as well as the others), default links from clicking on your site logo resolve to http://www.yourdomain.com/shop ... so, we decided to account for this by modifying the shop/index.php to the following:

Our /shop/index.php File
Code:
<? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: ./home.php" ); ?>

The above method utilizes the 301 Response (Permanent Redirect) method, which is exactly what we desired!

As for those of you using the HTML catalog, all of the method utilized above can work for you with simple modification (i.e. changing .php to .html, and changing the index.php example above to utilize the .htaccess Redirect permanent http://... method! Just place that .htaccess inside /shop!)

Hopefully this helps, it seemed to be the solution we needed with NO MODIFICATION to our existing shop, minus modifying the index files.
__________________
X-Cart 4.0.16-.19 Gold [unix] / DSEFU
Reply With Quote