I’m developing an API using Luracast Restler library. All I’m looking for is to have the index.php to be “hidden” from my URLs in order to keep within RESTful API standards. NOTE!: yes I have mod_rewrite enabled, and yes I have the .htaccess file in the directory. I had absolutely no problem getting this done on my machine, but when moving it into a production environment for some basic testing, the .htaccess file seems to be acting differently because index.php is required in the URL again!
Both my development machine and my production machine are running windows. Both use multiple Virtual Hosts. Both have mod_rewrite enabled.
My .htaccess file is literally the supplied example:
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
We have identical directory settings in httpd.conf:
<directory "C:\www">
Options FollowSymLinks -Includes -ExecCGI -Indexes -SymLinksIfOwnerMatch
order allow,deny
Allow from all
AllowOverride All
</directory>
And this configuration works great on my development machine. When I move it to production, it requires index.php in the URL in order for it to serve the request to my index.php file. If I remove the index.php from the URL I get a 404 from Apache (not a Restler response). I also get this error in the Apache logs:
File does not exist: C:/www/api_website_com/public/classname/function
It’s my understanding that this .htaccess should be rewriting my HTTP requests directly to index.php and not looking for the URL as if it were a file. Does anyone have any thoughts? It has to be something simple I am overlooking.
Also note that I cannot enable RewriteLog as I do not have access to the production server’s httpd.conf.
htaccess files, on this server, were configured to be a text file. For whatever reason this was done- it was a simple fix.