You are here:  » htaccess explanation for dummies?

Support Forum



htaccess explanation for dummies?

Submitted by Bob Murray on Sun, 2008-11-16 12:35 in

Hi. I've tried searching through the forum for something like this and I guess I'm the least experienced on the planet. I simply want to understand what it is exactly that I have to do in my htaccess file to complete my installation of Price Tapestry. I have installed it in a sub-directory and navigated to the setup.php file and the server is ready to create tables. But I haven't yet amended the htaccess file - which of course the server is now asking for. Trouble is - I don't understand what it is that I have to put in the htaccess file. I know this must be very basic for developers, but I'm only a site designer. I do understand the vital importance of friendly urls however and naturally, I want to make this happen. Here is the url to the setup.php file:

{link saved}

And the start of my htaccess file is of course:

Options -MultiViews

RewriteEngine On

RewriteBase /

RewriteRule ^product/(.*).html$ products.php?q=$1&rewrite=1&%{QUERY_STRING} [L]

What part of my existing (actual) url goes where? And do I actually have to create any folders such as "product", "merchant", "category" etc? Sorry to be such a dummy - I don't want to mess up the installation!

Hope someone can help - maybe this all exists somewhere else?

Submitted by support on Sun, 2008-11-16 15:06

Hello Bob,

When you have installed Price Tapestry into a sub-directory, all you need to do is make sure that RewriteBase matches the directory name that you have installed the script into. It is also the same as the setting needed in config.php for $config_baseHREF.

For example, if you have installed into the directory /shopping/, so the URL on your site would be:

http://www.example.com/shopping/

...then in .htaccess, edit the RewriteBase line as follows:

RewriteBase /shopping/

...and in config.php edit the $config_baseHREF line as follows:

  $config_baseHREF = "/shopping/";

Regarding the example URL posted in your email, I would not recommend installing the script into such a deep directory, for maximum search engine friendliness I would recommend no more than one sub-folder to the installation; and use a directory name that is relevant to your theme, or a generic folder name like /shopping/ or /comparison/

Hope this helps!

Cheers,
David.

Submitted by Bob Murray on Sun, 2008-11-16 16:07

Thanks so much David - that's very easy to understand now.

Regarding the folder location, I appreciate it is deeper than it ought to be. So, without interfering with the running of the program, can I assume that I can simply move the folder structure up one level - and dispense with the "Price Tapestry" holding folder? That is, move the contents of "Price Tapestry" into my "Products" folder (leaving the 'internal' folder structure in place?) Or can I go further and move the contents of PTED******C directly into "Products"? It looks for instance that the other folders from the download are largely informational.

Submitted by support on Sun, 2008-11-16 16:09

Hi Bob,

That's exactly right. Move everything up into /products/ (so that within that folder you have the files like index.php and merchants.php etc.) - that would be the best thing to do.

Cheers,
David.

Submitted by Bob Murray on Sun, 2008-11-16 16:46

Thanks David - one last issue (I hope).

As I already have an htaccess file sitting in my root directory (it is configured for Wordpress I suspect), I don't think that I should simply overwrite it. But at the moment, the PT htaccess file is in the "Products" directory alongside the rest of the installed files. I am at the point of creating tables again - and it can't find htaccess.

This is the content of thte existing (root) htaccess file:
# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

How should I proceed?
Thaks

Submitted by support on Sun, 2008-11-16 16:49

Hi Bob,

They shouldn't conflict, there is no reason why you can't have .htaccess in your /Products/ folder, and you don't need to make any changes to your top level / Wordpress .htaccess.

Make sure you have named it correctly as .htaccess and it should be fine. If you're having problems creating the file with that name, make your changes to htaccess.txt (should just be a case of editing RewriteBase) and then using your FTP program, right-click on htaccess.txt and look for a Rename... function in order to change the name to .htaccess

Cheers,
David.

Submitted by Bob Murray on Sun, 2008-11-16 17:05

Found the problem - hadn't saved htaccess with the leading "."!

All installed now - will go through the manual to see how to go about importing a feed.

Thanks so much for the rapid help. I'll try not to be such a dummy in future!

Regards

Bob

Submitted by Mark on Thu, 2008-12-04 23:34

I've read this very carefully and still can't work out how to mend the .htaccess file that I have just broken on my site http://www-fancy-dress.com/

The base directory is / and so I have tried copying the default .htaccess file to it and renaming it .htaccess but everything I do just results in

500 Internal Server Error

messages. I've made the site visible again by deleting the .htaccess completely but of course all the links now come up as broken :(

I don't normally have problems with .htaccess ??!!?

Mark

Comparison Shopping Sites http://cheapest-bargain.com/
http://cheapest-bargain.co.uk/
http://www-fancy-dress.com/

Submitted by support on Fri, 2008-12-05 10:01

Hi Mark,

"500 Internal Server" errors normally happen when there is a syntax error in .htaccess, however there shouldn't be any problem with the default htaccess.txt as supplied in the distribution.

Don't forget that in the mean time, you can keep your site working by setting $config_useRewrite = false; in config.php

500 errors are normally associated with an entry in your web servers error log. Do you have access to this as it might indicate exactly what the problem is...

Cheers,
David.

Submitted by Mark on Fri, 2008-12-05 10:53

Here is what I did:

1 Start with site working
2 Unzip original price tapestry file and extract htaccess.txt
3 Install to sites root directory using filezilla
4 rename htaccess.txt to .htaccess
5 get following message from site

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@www-fancy-dress.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.

6 rename .htaccess back to htaccess.txt
7 site visible again

Mark

Comparison Shopping Sites http://cheapest-bargain.com/
http://cheapest-bargain.co.uk/
http://www-fancy-dress.com/

Submitted by support on Fri, 2008-12-05 11:13

Hi Mark,

Do you have access to the error log to see the exact error message?

Cheers,
David.

Submitted by support on Fri, 2008-12-05 13:19

Further to a follow by email; removing the following line from .htaccess has resolved the problem...

Options -MultiViews