0

I am trying to rewrite the url for a rest call (backend written in php). The problem is, that the .htaccess file is not working, or the file in general is ignored by the server.

What i've tried

I've edited the httpd.conf file and changend following lines:

<Directory />
    Options All
    AllowOverride All
</Directory>
<Directory "${SRVROOT}/htdocs">
    Options All
    AllowOverride All
    Require all granted
</Directory>

i also added a Directory Tag for my specific folder:

<Directory "${SRVROOT}/htdocs/my/path/backend/">
    Options All
    AllowOverride All
</Directory>

My .htaccess file looks like this:

#.htaccess
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.+) index.php/$1 [L,QSA]

Because i am using the RewriteEngine i had to enable this module in the httpd.conf file:

LoadModule rewrite_module modules/mod_rewrite.so

Infos

I'm working on Windows 10 machine.
My Apache version is: 2.4.16 Win32

Problem

The problem is that the server ignores the .htaccess file. I know that because i tried to change the DefaultIndex with following line:

DirectoryIndex startPage.html

without any success.

YvesHendseth
  • 1,149
  • 1
  • 10
  • 27
  • I don't think `${SRVROOT}` will resolve to anything. – anubhava Oct 25 '15 at 18:09
  • @anubhava `${SRVROOT}` is defined at the beginning of the conf file: `Define SRVROOT "/Apache24"` – YvesHendseth Oct 25 '15 at 18:21
  • Have you installed mod_define ? – Sergio Ivanuzzo Oct 25 '15 at 19:02
  • 2
    @SergioIvanuzzo there is no module for define. I looked it up and it's in the core of apache 2.4 https://httpd.apache.org/docs/trunk/mod/core.html#define – YvesHendseth Oct 25 '15 at 19:19
  • IfDefine not work for me, maybe reason is that this directive only responds to parameters passed at the command line, according to http://stackoverflow.com/questions/11073752/apache-ifdefine-conditionals-in-htaccess – Sergio Ivanuzzo Oct 25 '15 at 20:10
  • 2
    I don't think your `SRVROOT` is correct. You are on a windows box not a linux. You said it's `Define SRVROOT "/Apache24"` Windows uses the drive letter, you need it to be `Define SRVROOT "C:/Apache24"` or whatever drive you have it on. – Panama Jack Oct 25 '15 at 20:57

0 Answers0