QUESTION:

Permlinks don’t work
I get a 404 error when trying to comment
I get a 404 error when trying to view article pages
I get a 404 error when trying to view section pages
The wrong content is displayed in clean URL mode



ANSWER:

These and similar problems happen when you use “clean” URL mode on a server that doesn’t support mod_rewrite in .htaccess, or requires additional configuration in order to work. The .htaccess file supplied with Textpattern is designed to work on most Apache servers, but there is no universal solution.

The Textpattern diagnostic page will attempt to warn you if it can determine that clean URLs are not supported on your system. However, it doesn’t detect all incompatible servers – the absence of a warning does not mean that your server supports clean URLs.

The simplest solution is to use “messy” URLs instead (see textpattern > admin > preferences > permanent link mode, and remove or move aside the .htaccess file).

Some servers support mod_rewrite, but require some additional configuration in order to make it work properly.

If your web server is Apache, and supports mod_rewrite in .htaccess, you can find some suggestions for specific web hosts in this forum thread. “1and1” is the most common host that requires such changes for clean URLs to work.

Hosts that support Textpattern clean URLs out of the box include TextDrive, DreamHost and BlueHost.

Most free or nearly free hosting services don’t support clean URLs at all. In some cases clean URLs appear to work fine at first glance, but might fail in subtle ways.

On servers that support mod_rewrite, the most common solution is to uncomment (remove the leading ‘#’ from) this line in .htaccess:

#RewriteBase /relative/web/path/

..and change the path as appropriate. If Textpattern is installed in your web site root (i.e. the front Textpattern page is at http://example.com/), you should use this:

RewriteBase /

If Textpattern is installed in a subdirectory (the front Textpattern page is at http://example.com/mydir/):

RewriteBase /mydir/

Other changes required on some hosts include:

DirectoryIndex index.php index.html

Or:

Options +FollowSymLinks

Both of these lines are included in the default .htaccess file, so you can simply uncomment them.

If you are configuring your own Apache server, or using a hosting arrangement that lets you modify your own Apache configuration settings, you might need to add the following to the appropriate place in httpd.conf:

AllowOverride FileInfo

If none of those changes work, or if they cause a 500 server error, you’ll need to use “messy” URLs instead, or ask your hosting company for help.