Use URL rewriting in Joomla

Posted in Tutorials

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

With Joomla 3.x, if you create an article within a category, it will automatically create an URL alias that looks like …

/index.php/8-python/1-python-if-else-statements

It has the number 8 for the category id and the “1” for the article id.   This is because in “System -> Global Configuration”, the “Search Engine Friendly URLs” is “Yes” by default.

joomla-sef-url

joomla-sef-url

However, the “Use URL rewriting” is “No” by default.  That is because you need to do some configuration before you set that to “Yes”.  What you need to do depends on your server and the instruction is shown when you hover over the label “Use URL rewriting” in the above screen.

For Apache server, it says that you have to rename the htaccess.txt to .htaccess file.  But that is only if you don’t already have an existing .htaccess file.  If you do, then you have to merge the contents of htaccess.txt to the existing .htaccess file.

If after doing that you get an internal server error or error 500, then try enabling the “RewriteBase /” line in the .htaccess …

##
# Uncomment following line if your webserver’s URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root).
##

RewriteBase /

This is especially true if your webserver’s URL is not directly related to physical file paths.