Using mod rewrite for nicer urls

Lotuscms edited this page Jul 11, 2011 · 4 revisions

This method will allow you to access pages through virtual folders. eg. '/index.php?page=contact' could be access through '/page/contact/'.

Requirements

  • PHP 5
  • Mod_rewrite PHP module must be installed and activated.

How to: Steps

  1. Create a file in the root folder of the CMS called '.htaccess' without the quotes.
  2. Paste the following into the file named '.htaccess' <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^page/(.+)/?$ index.php?page=$1 [L] RewriteRule ^page/(.+)?$ index.php?page=$1 [L] </IfModule>
  3. Save this file.
  4. Complete.

Please Note

  • You May want to update your menu links in order to reflect these new access routes. ie. edit a link, set type of external and set external link to '/page/PAGE_NAME/'
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.