Enable Clean URL's

Enable Clean URLs

A "clean URL" does not contain a query string within the URL (as found in the address bar). A clean URL would look like this:

http://www.your-site.com/project/one/

Note that the above URL does not contain "index.php?" - the following would be considering a messy URL.

http://www.your-site.com/index.php?/project/one/

What is the advantage to having Clean URLs?

They are simply much nicer, more semantic and easier to remember. Google will index both clean and messy URLs to their search engine.

Default Installation

The default installation of Indexhibit comes with messy URLs setup because many hosts do not allow clean URLs. You need to enable them.

What is required for Clean URLs?

Your server needs to have a server technology called "mod_rewrite" properly setup and enabled for your account. If you have any question whether you have this or not you should ask your hosting service. Or, you might simply try to the following instructions to see if clean URLs will work on your site.

Enabling clean URLs

First, make sure that you have changed the name of the "htaccess" file that ships with Indexhibit to ".htaccess" (with the opening .).

In the ndxzsite/config/options.php file change:

define('MODREWRITE', false);

to:

define('MODREWRITE', true);

Next, refresh your website and see if the links work as clean URL's.

Troubleshooting the .htaccess file

Aside from a server that does not have mod_rewrite (again, confirm with your host that it's available), the most common issue with the .htaccess file is that you may need to edit the file - all servers are setup slightly differently.

Indexhibit ships with the following htaccess rules:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.+) index.php

If this does not work, most of the time a simple correction will allow the file to work. We have found that the following rules are the most common necessary change. Note the addition of the slash on the last line:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.+) /index.php

If this does not work, there could be a variety of issues and you should ask your host if they have a recommended set of rules for making clean URL's/mod_rewrite work on their server.

If you find any other htaccess rules that work on your server let us know and we'll post them here.