I admit to being confused about the actions of many AOM users regarding the shop.php file. Specifically the need to rename it, usually to index.php. I understand why some people may choose to rename the file in this way; a directory is generally designed to display an index file during a call. So if you go to www.myfile.com, the system will look for an index (with almost any ending – .php, .html, etc.). If it does not find an index, it will display the contents of the directory. And this of course can raise issues of security and privacy, since anyone can see the contents of the directory, and may be able to access files they shouldn’t.
With Associate-O-Matic not using an index file, it’s probably normal to think that you must have one. And since shop.php is the public face of the program, that’s the one that gets renamed. Everybody’s happy. Except that you don’t have to rename the file, and doing so often complicates the operation of the site, especially if you’re not so web-savvy.
Note that while you can change the file name to almost anything within reason, do not change the .php extension; AOM will not function if you do.
A short version of this information is actually included in the Online Installation Instructions, as step #4. But it’s only part of the story. When you upgrade to a new version of AOM, either to the full version, or from an older version (such as V4.1.5 to V4.2.0, currently the latest available version), the previous file that you’ve renamed is not touched. Instead, the new shop.php file is uploaded alongside your old index.php file. This can result in a version mis-match, since you’re using new files with an old shop/index.php file, and your site may not function correctly.
Some users think it’s okay to have a shop.php and index.php file together, but besides the fact that it can then be completely confusing to try and deal with any errors that may arise, it may also lead to Google thinking you have two different sites with identical content. Never a good thing as far as search engines are concerned.
And there’s more. If you use the SEO function with the mod_rewrite rules, you will need to change every instance of shop.php to index.php (or whatever name you choose to use). So this line from ruleset#1:
RewriteRule ^reviews-([A-Za-z0-9]+)-([a-z0-9,]+)-([A-Za-z0-9]+)-([0-9]+)-([A-Za-z0-9_]+).html shop.php?c=$1&n=$2&i=$3&p=$4&a=reviews
RewriteRule ^reviews-([A-Za-z0-9]+)-([a-z0-9,]+)-([A-Za-z0-9]+)-([0-9]+)-([A-Za-z0-9_]+).html index.php?c=$1&n=$2&i=$3&p=$4&a=reviews
And so on. Occasionally, the rulesets are also upgraded, altho not with every version of the software. But when the rulesets are changed, you would again need to edit the rules to include the renaming of the shop.php file. If you don’t use the SEO function, this can be ignored.
One more noteworthy point: In the AOM control panel, at the top, is a view store link. If you change the shop.php file to any other name, this link does not appear. Which can make it cumbersome if you’re doing edits, unless you manually open another window to view the store while you’re working on it.
However, all of this information I’ve just covered can be ignored if you don’t change the shop.php file to some other name. And you can still have the security that an index file affords. How?
By putting this command in the top line of your .htaccess file:
This command says in effect, “Whenever someone loads this site in their browser, shop.php is to be used in place of an index file”.
And it’s just that simple. It affords you the security of not having your directory files exposed for the world to view, and prevents you from having to edit the shop.php file every time you upgrade. Plus you can use the rulesets without modification – just copy and paste them into the .htaccess file. An added benefit is that if someone goes to ‘www.mysite.com’, they don’t see ‘www.mysite.com/shop.php’. Note that the .htaccess file only applies to Linux/Unix based servers. If you have a Windows server, contact your webhost for help. More information on setting up a .htaccess file is available in this previous post.
So obviously I’m in favour of the ‘set-it-and-forget-it’ mentality. I don’t see any need to go the long way, and having to remember to edit files with every upgrade. What about you?