I have this htaccess setup on my clients site, they use godaddy
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.php [L,QSA]
it worked fine on my MAMP but does not seem to work on the server
they have setup a subdomain like demo.example.com and the htaccess exists in the demo folder but I get 404 trying to get to page like demo.example.com/test but demo.example.com/test.php works fine so this tells me the htaccess is not work. does anyone know what I need to do to make this work ?
Try:
1) Add this line into your .htaccess:
Options +FollowSymlinks2) Add leading slash before
$1, e.g.RewriteRule ^(.*)$ /$1.php [L,QSA]P.S. There are some “rumours” that GoDaddy may not pick up changes in .htaccess file straight away.
I would also suggest to define custom 404 error handler (simple PHP script) that may help with debugging this (put this line into your .htaccess):
ErrorDocument 404 /404.php404.php (as simple as this)
The details there may help identify the issue.
UPDATE:
We have a domain name & hosting that we do not use which is about to expire. So I have logged in and tested these rules myself. Got it working straight away. Here is the setup I have:
.htaccesswas already present and had only 1 line 9possibly left over from the site that was there originally):These lines were added to .htaccess:
I have created simple php file to check if it works. Called it
echo.php. Then I have tried these URLs:http://www.example.com/abcd— saw error page (as expected)http://www.example.com/echo— saw my page — echo.php (as expected)The full physical path to the echo.php is:
/home/content/b/u/y/buyxxxxxxx/html/echo.php; ftp/website root is/home/content/b/u/y/buyxxxxxxx/html/Try this simple setup. DO not do anything complex until you solve this issue.