Friday, August 14, 2009

Today's Joomla Tip: 404 Errors and mod_rewrite

Here's another tidbit about Apache servers and .htaccess.

Usually porting a Joomla site goes fairly smooth, but once in a while, for various reasons, there is trouble when turning on mod_rewrite for SEF. Usually it's a problem with the .htaccess file, some of which I've addressed in earlier posts. But sometimes, Apache server configuration settings can be the culprit.

One such scenario is a 404 error I recieved when navigating to anywhere but the home page. I couldn't be sure if it was the .htaccess file or a server setting, but then I found a great example of how to test whether mod_rewrite is enabled on the server.

It's important to note that redirects in the .htaccess file will still work, even if mod_rewrite is disabled. You need to specifically test with a rewrite rule. For example,

RewriteEngine On
RewriteRule ^link([^/]*).html$ rewrite.php [L]

...in your .htaccess file should redirect any .html file to a file called rewrite.php. If you can reach the rewrite.php file directly in your browser, but arbitrary .html files return a 404 error, you'll need to contact you web service provider and request that mod_rewrite be turned on.

If you'd like more help, then contact me here or via our website design Ottawa shop.

No comments:

Post a Comment