Thursday, April 15, 2010

Working with .htaccess files

I encountered some problems sometime ago on how to Change my Joomla URLS from Dynamic Content Management Systems to more readable URL’s then I spend a night up trying to figure out how to , tried different things and I end up with a solution, thought I do share it.
Information on .htaccess and Joomla.
What is it, what does it do and why should you bother?
What is it?
The htaccess.txt file is part of the Joomla core download.
You should find it in the root of your Joomla installation.
Once uploaded and renamed to .htaccess it is a special Apache file
What does it do?
The basic purpose of the .htaccess file here is to rewrite the cryptic URL’s from a dynamic content management system to more readable URL’s
For Apache to be able to do that, it needs to know some things about the URL Joomla produces and how they should be handled
This information is stored in the .htaccess file.
Why you should use it
If you want your Joomla website to have clean and friendly URL's, then you got to know the .htacces file.
This means that your URLs are reading like normal pages that contain your keywords.
This will give them a better Search Engine index as well as easier for you visitors to remember.
So a Link like:  http://mywebsite.com/index.php?option=com_profile&view=profile&Itemid=76
Will not do as well as:  http://mywebsite.com/profile
Basic Technical Needs
Joomla Basic SEO on Apache and .htaccess
To be able to work with this it requires you to have a hosting platform based on Apache and with the MOD_Rewrite for Apache turned on.
You can check this in Joomla itself from the administrator backend.
Or ask you Hosting Provider Support team, they can turn it on for Your hosting account as well.
Is Apache ready?
Now lets us look at the htacces.txt file.
If you installed Joomla in a Subdirectory, you need to change one line
BaseRewrite
That has to reflect the real path to Joomla.
For example BaseRewrite/~user/htdocs/Joomla. Otherwise leave it the same
Then rename the file htaccess.txt to .htaccess via your FTP Program.
What happened? It disappeared from your screen!
That is because this file is very special to Unix, it is a hidden file and if you want to see it again, you have to change your view to show you the hidden files.
Filezilla FTP has this as an option.
Now you can turn on the SEO function of Joomla in the Global Configuration
Or go to your Configuration.php file found in your site root directory and change these settings;
$sef = '1';
$sef_rewrite = '1';
$sef_suffix = '0';
Note that: 0=off and 1=on

1 comment:

  1. man i honeslty never know that you were such a "GEEK" 'till now.. keep the blogs coming man., very nice....

    ReplyDelete