View Full Version : Use .htaccess or index.php
I am trying to make sure that my DNS entry and hosting configurations are correct. My host (hostasaurus) says that I have two options to make sure that the first page someone sees when they enter the store url at www.mysite.com is to use either a .htaccess file or index.php file.
The instructions say that the .htaccess method is "less preferable" than the index.php file.
To implement the index.php file, they say the file needs to contain:
<?php
header("HTTP/1.1 301 Moved Permanently");
header ( "Location: /Merchant2/merchant.mvc" );
?>
My question is that since this is a "redirect", will search engines cough on this? I thought that they hated these kind of things.
Is .htaccess the preferred way of doing this?
Thanks
Fredric Gluck
MarketThink, LLC
ILoveHostasaurus
04-04-06, 04:29 PM
The downside to the .htaccess method is that the .htaccess file must be parsed by the server for statements on every request, including image requests and anything else. If you would not otherwise have a .htaccess file, the PHP method is less overhead.
That's interesting to know, .htaccess file get parsed for each server request.
I am hav been using .htaccess for makiny my store SEO friendly. I hav minimal links having merchant.mvc? etc.
Though, i hav observerd any performance drop, may be if i run compare tests b/w old way and new way, i might see.
though using .htaccess was very easy way. In couple of hrs, all my links were seo name friendly.
ILoveHostasaurus
04-04-06, 04:43 PM
The processing requirements for parsing the file are negligible so it won't normally result in a visible difference except on a very high traffic site.
OK... I can accept that the host will plan for this overhead and take it into account.
Which alternative is most suitable and most acceptable for search engines?
ILoveHostasaurus
04-04-06, 04:59 PM
I personally think an optimized home page containing lots of relevant content and well-constructed html is much better than directing the site's homepage to the Merchant storefront.
truXoft
04-04-06, 07:34 PM
Personally I'd tell that parsing a PHP file will cause much more overhead than parsing an .htaccess file, especially because the content of the .htaccess file (better told the parsed status) is stored in the operating memory and not being re-parsed unless the file changes. At an external script, the engine has to be accessed, and I'd expect much bigger impact. However, if you do not trust my opinion, you can always set the DirectoryIndex directive in the global httpd.conf file - that is being parsed only once at the boot time. In any case, both methods are completely negligible in comparison to the overhead of a Miva Empresa driven page. For that reason, at a website with huge traffic caused mostly by visitors who do not browse the store, using a plain HTML index page may be the best solution - visitors who land on it by mistake will leave without triggering any Miva or PHP driven page and will not cause any considerable slowdown of the server.
jason - jmh web services
04-07-06, 10:24 AM
OK... I can accept that the host will plan for this overhead and take it into account.
Which alternative is most suitable and most acceptable for search engines?
Use the .htaccess method
Jason
Thanks for the input here....
I created a .htaccess file with the following in it:
DirectoryIndex index.html /miva/merchant.mvc
and put it in my home directory.
I renamed index.html (a default file provided by the host) to index_orig.html (just for safety's sake) and it works like a champ.
One tip -- if you use an FTP program to move the file from your local PC to the UNIX host, remember that some programs do not list files that begin with ".". so don't worry if you don't see the file.
Hostasaurus -- you might want to update your FAQ document so that it reflects M5 directory structure.
Thanks again for the forum help!
tomg802
04-10-06, 07:44 PM
Is there a good tutor page out there, that shows how to create a htaccess file?
.htaccess seems to be one of those magic files that can do just about anything. Kind of like a swiss army knife. I believe that it is one of the key components used in rewriting URLS so that they are search friendly.
I Googled ".htaccess rewrite engine" and this seems to be a well written reference page
http://corz.org/serv/tricks/htaccess2.php
Looks like alot of mind-bending stuff. Great reading!:rolleyes:
Brandon MUS
04-10-06, 09:44 PM
Just an alternative approach to this:
#############
# Rewrite web root to /SUBDIR
#############
RewriteEngine On
RewriteRule ^$ /SUBDIR [R=301,L]
Is the code I use.
tomg802
04-11-06, 12:33 AM
Just an alternative approach to this:
#############
# Rewrite web root to /SUBDIR
#############
RewriteEngine On
RewriteRule ^$ /SUBDIR [R=301,L]
Is the code I use.
If I have this correct this file you put in your root folder and then anything directed to your root folder is sent to your subfolder?
Does this get rid of the MM5 in the url to Miva, which is what I am after? Does anyone else have a htaccess file they would share to shorten the URL to exclude the MM5 directory in the URL.
After reading many pages about rewrite, I still don't get it.
Brandon MUS
04-11-06, 12:46 AM
Are you trying to "hide" the Miva URL? Or just redirect to it?
The code I posted will only redirect to it. There are other rewrite rules you can use to hide it completely, but you will have to do a lot of work inside of MM (changing the linking structure) to continue to surpress the /Merchant directory beyond the first link, if that's what you are after.
Brandon
tomg802
04-11-06, 11:05 AM
Hi I'm trying to change the url with mod_rewrite, I just think having a site store that points to www.whatever.com/mm5/ (http://www.whatever.com/mm5/) looks bad, and people will not remember the mm5, but would be more likely to remember www.whaterver.com/productsname (http://www.whaterver.com/productsname).
And on a more practical level I use some php pages, that work on a database and dicovered that because I use a shared ssl license on my sites, when you link to miva without using the MIVA variables in the url people get a nasty looking message about the domain not matching the certificate.
I have redirected with the sever, would rather people and search engines where unaware of the redirect.
ILoveHostasaurus
04-11-06, 03:19 PM
The only time you should get an error about the name not matching is if you tried to link to https://www.yourdomain.com instead of https://sharedssl.host.com
tomg802
04-11-06, 07:30 PM
This is correct but if I link to the secured server and not https://mydomain.com and a person adds something to their basket and then goes to check out, the session is lost and their basket is forever empty.
The only way we could keep the session was to use the variables in Miva on the MIVA pages. This works great in MIVA, but when linking from a php application I have to use the https://mydomain.com or lose the session.
ILoveHostasaurus
04-12-06, 06:51 AM
A loss of basket when switching between shared SSL and regular URL's is typically caused by the host not having P3P compact headers set on both the regular and secure sites to encourage IE to pass and accept the cookies; that is mandatory in a shared SSL environment.
Here's a post from me about this from a few years ago: 2002-01-17 (http://listmgr.miva.com/mru/index.mvc?control=display&msid=id78116)
If you want to private message me your URL, I can check it for the headers.
vBulletin® v3.7.4, Copyright ©2000-2008, Jelsoft Enterprises Ltd.