RewriteEngine on RewriteBase / # Get the base RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+[^/])$ /$1/ # Set the page RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9]+)/?$ /index.php?page=$1 # Set the action RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9]+)/?$ /index.php?page=$1&action=$2 # Set the item RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9]+)/([0-9]+)/?$ /index.php?page=$1&action=$2&item=$3 # Set the choice RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9]+)/([A-Za-z]+)/?$ /index.php?page=$1&action=$2&choice=$3 # Set the item with pagination RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9]+)/([0-9]+)/page([0-9]+)/?$ /index.php?page=$1&action=$2&item=$3&num=$4 # Set the choice with pagination RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z0-9]+)/([A-Za-z0-9]+)/([A-Za-z]+)/page([0-9]+)/?$ /index.php?page=$1&action=$2&choice=$3&num=$4