views:

159

answers:

1

I have the following in my .htaccess file, which I do often for cleaner URL's. There are pro's and cons to this I know and I think I've found a con.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Options All -Indexes

I've up a new cPanel account for this website so the URL looks like this:

http://www.example.com/~newuser/

...where example.com is my reseller account and newuser is my client.

The site loads fine but when I click a link http://www.example.com/~newuser/about I get the following error:

The requested URL /home/newuser/public_html/about.php was not found on this server.

The problem is, that's exactly the file I want it to display and that is the document root. Any ideas?

Thanks in advance.

+1  A: 

Before your RewriteCond lines, add a RewriteBase line like so:

RewriteEngine on
RewriteBase /~newuser/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
Options All -Indexes
Mark
YES! Mark, you saved me ripping hair out. stackoverflow.com, I love you.
jeerose