There have been a few posts now regarding getting .htaccess to work. Every host/server is different so your mileage may vary outside of 000webhost, but this works perfectly for me.
Code:
# Handle real errors with index.php
ErrorDocument 403 /index.php
ErrorDocument 404 /index.php
#
Order Deny,Allow
<FilesMatch "\.ht(access|passwd)$">
Deny from all
</FilesMatch>
#
# challenging but recommended way of developing
php_value allow_call_time_pass_reference 0
#
Options +FollowSymLinks
RewriteEngine on
#
#Redirect domain.com to www.domain.com
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.domain\.co\.uk
RewriteRule (.*) http://www.domain.co.uk/$1 [L]
#Use friendly URLs (or failing that output the path to $_GET['rt'])
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteCond %{REQUEST_URI} !^/robots.txt$
RewriteCond %{REQUEST_URI} !\.(gif|jpe?g|png|css|js|pdf|doc|xml)$
RewriteCond %{REQUEST_URI} !-f
RewriteRule (.*) /index.php?rt=$1 [L]
This .htaccess is intended to be used in conjunction with an MVC programming model, explained in this excellent Tutorial:
http://www.phpro.org/tutorials/Model...oller-MVC.html
One thing to note is that this script
disables $_GET from working in most circumstances (anything other than index.php). Instead, use either $_SESSION or pass values around using $_POST.