0

I have an application which requires an htaccess file in the directory /tileserver/ that contains the following:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(tileserver\.php)
RewriteRule ^(.*)$ tileserver.php?/$1 [L,QSA]

what I need is for any URL request to tileserver/

to instead be

tileserver/tileserver.php/

but then if I add something like:

RewriteRule ^tileserver/(.*)$ tileserver/tileserver.php/$1

it has no effect. How do I write this rule?

update here is a line from the error log:

[Thu Dec 17 13:17:48.858560 2015] [negotiation:error] [pid 23573] [client 108.44.58.67:64411] AH00687: Negotiation: discovered file(s) matching request: /var/www/html/tileserver/extra5 (None could be negotiated)., referer: http://107.170.120.88/tileserver/
Froggiz
  • 3,043
  • 1
  • 19
  • 30
mheavers
  • 127
  • 7

1 Answers1

0

The request will start with / so you need to change it for

RewriteEngine On
RewriteRule ^/tileserver/(.*)$ /tileserver/tileserver.php/$1 [L]
Froggiz
  • 3,043
  • 1
  • 19
  • 30
  • Hmmm, this didn't work. The htaccess file is in the "tileserver" directory - does it need to just work from the tileserver root? I tried: `^(.*)$ tileserver.php/$1` also but that didn't work – mheavers Dec 16 '15 at 16:57
  • are you sure .htaccess are activated on the server ? – Froggiz Dec 16 '15 at 18:03
  • Yes, I'm positive. It works for other purposes. – mheavers Dec 17 '15 at 14:12
  • Can you add an sample of URL before & after rewrite you want please ? – Froggiz Dec 17 '15 at 14:14
  • Yes - thanks - it would be: http://107.170.120.88/tileserver/tileserver.php/extra5/11/331/794.png instead of http://107.170.120.88/tileserver/extra5/11/331/794.png – mheavers Dec 17 '15 at 17:59
  • so the rewrite rule i posted should works and transform to `/tileserver/extra5/11/331/794.png` to `/tileserver/tileserver.php/extra5/11/331/794.png`, i added the [L] flag to prevent extra Rule to be executed after if this one matched. To trace whats is going wrong you need to display rewrite logs : `RewriteLog "/usr/local/var/apache/logs/rewrite.log"` + `RewriteLogLevel 3` in your server configuration then if you don't know how to read log, please post them in your original post as edit – Froggiz Dec 17 '15 at 18:07
  • Ok, I've updated the question with the result of the log. – mheavers Dec 17 '15 at 18:21
  • And do you have any rewrite log ? – Froggiz Dec 17 '15 at 18:24
  • No - I don't seem to be able to write to the log file. Would it be possible to chat briefly? – mheavers Dec 17 '15 at 18:25
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/33121/discussion-between-froggiz-and-mheavers). – Froggiz Dec 17 '15 at 18:27