Dear All,

This must be a very common problem, but yet nowhere on the internet wishes to display a working answer. I am in a sticky situation.

I have the following .htaccess file on my local webserver:

http://localhost/testsite/.htaccess

DirectoryIndex home.php?view=home

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ home.php?view=$1 [QSA,L]

ErrorDocument 404 /home.php?view=404

I now upload this file to http://domain.com/.htaccess and it simply will not work (404 errors). The URLs are meant to work like this:

http://domain.com/gallery
transforms server side to
http://domain.com/home.php?view=gallery

Please could someone suggest where my code may be going wrong and why?

Thanks so much!

I have a solution:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /home.php?view=$1 [L]
</IfModule>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.