When you use a domain name, you simply define following rules in .htaccess file:
Code: Select all
# Rewrite URL rules
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
But if you use IP address on shared hosting (ex.: 123.123.123.123/~username/),
these rules must be defined in following way:
Code: Select all
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /~username
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
# This way
RewriteRule ^(.*)$ /~username/index.php?url=$1 [QSA,L]
# or another option
# RewriteRule .? /~username/index.php
</IfModule>