Reputation: 3092
I have a .htaccess file with the following rule:
RewriteRule ^api\/([A-Za-z0-9\-]+)\/?([0-9=a-zA-Z%]+)?\/?$ api.php?service=$1¶m=$2 [QSA,L]
For some reason, it's working on my host, but not on my local LAMP-installation. Is there something I'm doing wrong?
Apache version: Apache/2.2.22 (Ubuntu)
Error message: 404 Not Found ("The requested URL /api/word/search/ was not found on this server.")
Edit: There is another rewrite rule that is working, so the mod_rewrite module is activated:
RewriteRule ^([a-z]+)\.page$ index.php?template=$1 [QSA,L]
Apache site configuration is (locally):
DocumentRoot /var/www/Development-Env
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/Development-Env/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Edit #2 I am trying to match http://localhost/api/service/method/
.
Upvotes: 0
Views: 770
Reputation: 11799
According to this Options Indexes FollowSymLinks MultiViews
in your question, I guess the problem is MultiViews is enabled.
You may try adding this line on top of the rewrite rule-set:
Options +FollowSymlinks -MultiViews
Upvotes: 1
Reputation: 1284
it is possible that apache mod rewrite is not enabled , or htaccess not alowed. and dont forget before all of that
RewriteEngine On
you cna also
try RewriteRule ^api/(.*)/(.*)$ api.php?a=$1&d=$2 [NC]
man use codeigniter if you need an api you have a api i used this
http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/
Upvotes: 1