Cannot set up mod_rewrite with XAMPP












1














I'm trying to enable mod_rewrite on a XAMPP 5.6.3 installation. I've been following these guides:




  • http://www.leonardaustin.com/blog/technical/enable-mod_rewrite-in-xampp/

  • http://www.lancelhoff.com/enabling-htaccess-in-apache-on-windows/

  • https://apple.stackexchange.com/questions/47526/enable-url-rewriting-mod-rewrite-using-htaccess-files-in-sites-on-lion


...and a bunch of other I managed to google up. Unfortunately, to no avail.



I have a project that was developed under Linux, working perfectly there, having .htaccess file inside:



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]


I have tried:




  1. Making sure that the line LoadModule rewrite_module modules/mod_rewrite.so is not commented in httpd.conf.

  2. Replacing AllowOverride none with AllowOverride all in httpd.conf (2 or 3 occurrences).

  3. Adding AllowOverride all directives in all <Directory> sections I have added to httpd-vhosts.conf when the above didn't work, just in case.

  4. Restarting after changes #2 and #3.


I'm trying to access URLs in the directory with .htaccess file, but none of them presumably get rewritten probably, and give 404. Access to the file that they should be rewritten to is possible, and gives no errors. Accessing .htaccess itself gives 403.



I also tried adding:



RewriteLog "C:/XAMPP/apache/logs/rewrite.log"
RewriteLogLevel 3


...both to httpd.conf and httpd-vhosts.conf, sometimes without RewriteLog, but, when I do that, Apache refuses to start - sometimes it spits generic error messages into XAMPP console, sometimes it just hangs. It doesn't write anything at error.log though. So, no mod_rewrite debug output. phpinfo(), however, shows that the loaded modules are:




core mod_win32 mpm_winnt http_core mod_so mod_access_compat mod_actions mod_alias mod_allowmethods mod_asis mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dav_lock mod_dir mod_env mod_headers mod_include mod_info mod_isapi mod_log_config mod_cache_disk mod_mime mod_negotiation mod_proxy mod_proxy_ajp mod_rewrite mod_setenvif mod_socache_shmcb mod_ssl mod_status mod_version mod_php5




So it should be in more or less working order.



This is driving me mad. Please help.



Below are the full contents of anything that looks remotely useful:



httpd.conf:



ServerRoot "C:/XAMPP/apache"


Listen 80

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_lock_module modules/mod_dav_lock.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule cache_disk_module modules/mod_cache_disk.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule status_module modules/mod_status.so
LoadModule version_module modules/mod_version.so

<IfModule unixd_module>
User daemon
Group daemon

</IfModule>


ServerAdmin postmaster@localhost

ServerName localhost:80

<Directory />
AllowOverride all
Require all denied
</Directory>


DocumentRoot "C:/XAMPP/htdocs"
<Directory "C:/XAMPP/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride All

Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm
default.php default.pl default.cgi default.asp default.shtml default.html default.htm
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>

<Files ".ht*">
Require all denied
</Files>

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio
</IfModule>


CustomLog "logs/access.log" combined
</IfModule>

<IfModule alias_module>


ScriptAlias /cgi-bin/ "C:/XAMPP/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "C:/XAMPP/cgi-bin">
AllowOverride All
Options None
Require all granted
</Directory>

<IfModule mime_module>
TypesConfig conf/mime.types

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddHandler cgi-script .cgi .pl .asp


AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>

<IfModule mime_magic_module>
MIMEMagicFile "conf/magic"
</IfModule>






Include conf/extra/httpd-mpm.conf

Include conf/extra/httpd-multilang-errordoc.conf

Include conf/extra/httpd-autoindex.conf

Include conf/extra/httpd-languages.conf

Include conf/extra/httpd-userdir.conf

Include conf/extra/httpd-info.conf

Include conf/extra/httpd-vhosts.conf



Include "conf/extra/httpd-proxy.conf"
Include "conf/extra/httpd-default.conf"
Include "conf/extra/httpd-xampp.conf"

<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

Include conf/extra/httpd-ssl.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


AcceptFilter http none

<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-ajp.conf"
</IfModule>
</IfModule>


httpd-vhosts.conf:



<VirtualHost *:80>
ServerAdmin septagramm@gmail.com
DocumentRoot "S:/efit_rails4/public"
Alias /remote-control "S:/ssm-misc/remote-control"
<Directory "S:/efit_rails4/public">
Require all granted
AllowOverride All
</Directory>
<Directory "S:/ssm-misc/remote-control">
Require all granted
AllowOverride All
</Directory>
ServerName SSM
</VirtualHost>


bottom of error.log:



[Fri Nov 28 05:43:56.875099 2014] [mpm_winnt:notice] [pid 9780:tid 380] AH00456: Apache Lounge VC11 Server built: Jul 17 2014 11:50:08
[Fri Nov 28 05:43:56.875099 2014] [core:notice] [pid 9780:tid 380] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/XAMPP/apache'
[Fri Nov 28 05:43:56.876100 2014] [mpm_winnt:notice] [pid 9780:tid 380] AH00418: Parent: Created child process 8276
[Fri Nov 28 05:43:57.155297 2014] [ssl:warn] [pid 8276:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 28 05:43:57.255380 2014] [ssl:warn] [pid 8276:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 28 05:43:57.280385 2014] [mpm_winnt:notice] [pid 8276:tid 384] AH00354: Child: Starting 150 worker threads.
[Fri Nov 28 05:44:18.865136 2014] [authz_core:error] [pid 8276:tid 1728] [client 127.0.0.1:63898] AH01630: client denied by server configuration: S:/ssm-misc/remote-control/api/.htaccess


Update



After some persuasion (and help from @AD7six) I was able to get the debug output working. There appears to be a new-ish way to configure that:



RewriteBase /remote-control/api/


I'm weirded out by the rewrite mod seemingly rewriting the URL correctly and then promptly serving 404. Also, I tried experimenting and found out that if I add an explicit rewrite base equal to the current directory, e.g.:



RewriteBase /remote-control/api/


The rewrite sort of works - I get index.php served, though I have other errors so I can't quite confirm if it truly works. However, I'm not entirely satisfied with this as a solution. Besides, the debug output in this case is somewhat longer, as if it's making another pass or something. And in the end, it comes to an identical filename, but without 404:



[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] strip per-dir prefix: S:/ssm-misc/remote-control/api/session -> session
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] applying pattern '^' to uri 'session'
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace2] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] rewrite 'session' -> 'index.php'
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] add per-dir prefix: index.php -> S:/ssm-misc/remote-control/api/index.php
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace2] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] trying to replace prefix S:/ssm-misc/remote-control/api/ with /remote-control/api/
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace1] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] internal redirect with /remote-control/api/index.php [INTERNAL REDIRECT]
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] strip per-dir prefix: S:/ssm-misc/remote-control/api/index.php -> index.php
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] applying pattern '^' to uri 'index.php'
[Thu Dec 04 00:37:31.418478 2014] [rewrite:trace1] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] pass through S:/ssm-misc/remote-control/api/index.php


What can possibly be going on here?










share|improve this question















migrated from serverfault.com Dec 3 '14 at 13:45


This question came from our site for system and network administrators.











  • 1




    Are you sure you're not using apache 2.4? RewriteLog was replaced by LogLevel xxx rewrite:yyy - which would make the config invalid and apache refuse to start. You will find it easier to remove everything from the config that's irrelevant to the question (Especially commented out noise, but I don't just mean in the question - I mean on your dev machine) so as to focus on the problem. I don't see how any dev-setup problem (xampp) is relevant to serverfault - this question is more appropriate for stack overflow.
    – AD7six
    Dec 3 '14 at 13:27










  • @AD7six, you were right, and that enabled to get some debug output. I'll update the question ASAP. As for the config noise, I'll remove the commented parts today, I'm sorry for dumping all this onto community (( As for what is not connected, I won't be able to always tell what is noise and what is not.
    – Septagram
    Dec 3 '14 at 13:52
















1














I'm trying to enable mod_rewrite on a XAMPP 5.6.3 installation. I've been following these guides:




  • http://www.leonardaustin.com/blog/technical/enable-mod_rewrite-in-xampp/

  • http://www.lancelhoff.com/enabling-htaccess-in-apache-on-windows/

  • https://apple.stackexchange.com/questions/47526/enable-url-rewriting-mod-rewrite-using-htaccess-files-in-sites-on-lion


...and a bunch of other I managed to google up. Unfortunately, to no avail.



I have a project that was developed under Linux, working perfectly there, having .htaccess file inside:



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]


I have tried:




  1. Making sure that the line LoadModule rewrite_module modules/mod_rewrite.so is not commented in httpd.conf.

  2. Replacing AllowOverride none with AllowOverride all in httpd.conf (2 or 3 occurrences).

  3. Adding AllowOverride all directives in all <Directory> sections I have added to httpd-vhosts.conf when the above didn't work, just in case.

  4. Restarting after changes #2 and #3.


I'm trying to access URLs in the directory with .htaccess file, but none of them presumably get rewritten probably, and give 404. Access to the file that they should be rewritten to is possible, and gives no errors. Accessing .htaccess itself gives 403.



I also tried adding:



RewriteLog "C:/XAMPP/apache/logs/rewrite.log"
RewriteLogLevel 3


...both to httpd.conf and httpd-vhosts.conf, sometimes without RewriteLog, but, when I do that, Apache refuses to start - sometimes it spits generic error messages into XAMPP console, sometimes it just hangs. It doesn't write anything at error.log though. So, no mod_rewrite debug output. phpinfo(), however, shows that the loaded modules are:




core mod_win32 mpm_winnt http_core mod_so mod_access_compat mod_actions mod_alias mod_allowmethods mod_asis mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dav_lock mod_dir mod_env mod_headers mod_include mod_info mod_isapi mod_log_config mod_cache_disk mod_mime mod_negotiation mod_proxy mod_proxy_ajp mod_rewrite mod_setenvif mod_socache_shmcb mod_ssl mod_status mod_version mod_php5




So it should be in more or less working order.



This is driving me mad. Please help.



Below are the full contents of anything that looks remotely useful:



httpd.conf:



ServerRoot "C:/XAMPP/apache"


Listen 80

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_lock_module modules/mod_dav_lock.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule cache_disk_module modules/mod_cache_disk.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule status_module modules/mod_status.so
LoadModule version_module modules/mod_version.so

<IfModule unixd_module>
User daemon
Group daemon

</IfModule>


ServerAdmin postmaster@localhost

ServerName localhost:80

<Directory />
AllowOverride all
Require all denied
</Directory>


DocumentRoot "C:/XAMPP/htdocs"
<Directory "C:/XAMPP/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride All

Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm
default.php default.pl default.cgi default.asp default.shtml default.html default.htm
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>

<Files ".ht*">
Require all denied
</Files>

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio
</IfModule>


CustomLog "logs/access.log" combined
</IfModule>

<IfModule alias_module>


ScriptAlias /cgi-bin/ "C:/XAMPP/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "C:/XAMPP/cgi-bin">
AllowOverride All
Options None
Require all granted
</Directory>

<IfModule mime_module>
TypesConfig conf/mime.types

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddHandler cgi-script .cgi .pl .asp


AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>

<IfModule mime_magic_module>
MIMEMagicFile "conf/magic"
</IfModule>






Include conf/extra/httpd-mpm.conf

Include conf/extra/httpd-multilang-errordoc.conf

Include conf/extra/httpd-autoindex.conf

Include conf/extra/httpd-languages.conf

Include conf/extra/httpd-userdir.conf

Include conf/extra/httpd-info.conf

Include conf/extra/httpd-vhosts.conf



Include "conf/extra/httpd-proxy.conf"
Include "conf/extra/httpd-default.conf"
Include "conf/extra/httpd-xampp.conf"

<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

Include conf/extra/httpd-ssl.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


AcceptFilter http none

<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-ajp.conf"
</IfModule>
</IfModule>


httpd-vhosts.conf:



<VirtualHost *:80>
ServerAdmin septagramm@gmail.com
DocumentRoot "S:/efit_rails4/public"
Alias /remote-control "S:/ssm-misc/remote-control"
<Directory "S:/efit_rails4/public">
Require all granted
AllowOverride All
</Directory>
<Directory "S:/ssm-misc/remote-control">
Require all granted
AllowOverride All
</Directory>
ServerName SSM
</VirtualHost>


bottom of error.log:



[Fri Nov 28 05:43:56.875099 2014] [mpm_winnt:notice] [pid 9780:tid 380] AH00456: Apache Lounge VC11 Server built: Jul 17 2014 11:50:08
[Fri Nov 28 05:43:56.875099 2014] [core:notice] [pid 9780:tid 380] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/XAMPP/apache'
[Fri Nov 28 05:43:56.876100 2014] [mpm_winnt:notice] [pid 9780:tid 380] AH00418: Parent: Created child process 8276
[Fri Nov 28 05:43:57.155297 2014] [ssl:warn] [pid 8276:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 28 05:43:57.255380 2014] [ssl:warn] [pid 8276:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 28 05:43:57.280385 2014] [mpm_winnt:notice] [pid 8276:tid 384] AH00354: Child: Starting 150 worker threads.
[Fri Nov 28 05:44:18.865136 2014] [authz_core:error] [pid 8276:tid 1728] [client 127.0.0.1:63898] AH01630: client denied by server configuration: S:/ssm-misc/remote-control/api/.htaccess


Update



After some persuasion (and help from @AD7six) I was able to get the debug output working. There appears to be a new-ish way to configure that:



RewriteBase /remote-control/api/


I'm weirded out by the rewrite mod seemingly rewriting the URL correctly and then promptly serving 404. Also, I tried experimenting and found out that if I add an explicit rewrite base equal to the current directory, e.g.:



RewriteBase /remote-control/api/


The rewrite sort of works - I get index.php served, though I have other errors so I can't quite confirm if it truly works. However, I'm not entirely satisfied with this as a solution. Besides, the debug output in this case is somewhat longer, as if it's making another pass or something. And in the end, it comes to an identical filename, but without 404:



[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] strip per-dir prefix: S:/ssm-misc/remote-control/api/session -> session
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] applying pattern '^' to uri 'session'
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace2] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] rewrite 'session' -> 'index.php'
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] add per-dir prefix: index.php -> S:/ssm-misc/remote-control/api/index.php
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace2] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] trying to replace prefix S:/ssm-misc/remote-control/api/ with /remote-control/api/
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace1] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] internal redirect with /remote-control/api/index.php [INTERNAL REDIRECT]
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] strip per-dir prefix: S:/ssm-misc/remote-control/api/index.php -> index.php
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] applying pattern '^' to uri 'index.php'
[Thu Dec 04 00:37:31.418478 2014] [rewrite:trace1] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] pass through S:/ssm-misc/remote-control/api/index.php


What can possibly be going on here?










share|improve this question















migrated from serverfault.com Dec 3 '14 at 13:45


This question came from our site for system and network administrators.











  • 1




    Are you sure you're not using apache 2.4? RewriteLog was replaced by LogLevel xxx rewrite:yyy - which would make the config invalid and apache refuse to start. You will find it easier to remove everything from the config that's irrelevant to the question (Especially commented out noise, but I don't just mean in the question - I mean on your dev machine) so as to focus on the problem. I don't see how any dev-setup problem (xampp) is relevant to serverfault - this question is more appropriate for stack overflow.
    – AD7six
    Dec 3 '14 at 13:27










  • @AD7six, you were right, and that enabled to get some debug output. I'll update the question ASAP. As for the config noise, I'll remove the commented parts today, I'm sorry for dumping all this onto community (( As for what is not connected, I won't be able to always tell what is noise and what is not.
    – Septagram
    Dec 3 '14 at 13:52














1












1








1







I'm trying to enable mod_rewrite on a XAMPP 5.6.3 installation. I've been following these guides:




  • http://www.leonardaustin.com/blog/technical/enable-mod_rewrite-in-xampp/

  • http://www.lancelhoff.com/enabling-htaccess-in-apache-on-windows/

  • https://apple.stackexchange.com/questions/47526/enable-url-rewriting-mod-rewrite-using-htaccess-files-in-sites-on-lion


...and a bunch of other I managed to google up. Unfortunately, to no avail.



I have a project that was developed under Linux, working perfectly there, having .htaccess file inside:



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]


I have tried:




  1. Making sure that the line LoadModule rewrite_module modules/mod_rewrite.so is not commented in httpd.conf.

  2. Replacing AllowOverride none with AllowOverride all in httpd.conf (2 or 3 occurrences).

  3. Adding AllowOverride all directives in all <Directory> sections I have added to httpd-vhosts.conf when the above didn't work, just in case.

  4. Restarting after changes #2 and #3.


I'm trying to access URLs in the directory with .htaccess file, but none of them presumably get rewritten probably, and give 404. Access to the file that they should be rewritten to is possible, and gives no errors. Accessing .htaccess itself gives 403.



I also tried adding:



RewriteLog "C:/XAMPP/apache/logs/rewrite.log"
RewriteLogLevel 3


...both to httpd.conf and httpd-vhosts.conf, sometimes without RewriteLog, but, when I do that, Apache refuses to start - sometimes it spits generic error messages into XAMPP console, sometimes it just hangs. It doesn't write anything at error.log though. So, no mod_rewrite debug output. phpinfo(), however, shows that the loaded modules are:




core mod_win32 mpm_winnt http_core mod_so mod_access_compat mod_actions mod_alias mod_allowmethods mod_asis mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dav_lock mod_dir mod_env mod_headers mod_include mod_info mod_isapi mod_log_config mod_cache_disk mod_mime mod_negotiation mod_proxy mod_proxy_ajp mod_rewrite mod_setenvif mod_socache_shmcb mod_ssl mod_status mod_version mod_php5




So it should be in more or less working order.



This is driving me mad. Please help.



Below are the full contents of anything that looks remotely useful:



httpd.conf:



ServerRoot "C:/XAMPP/apache"


Listen 80

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_lock_module modules/mod_dav_lock.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule cache_disk_module modules/mod_cache_disk.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule status_module modules/mod_status.so
LoadModule version_module modules/mod_version.so

<IfModule unixd_module>
User daemon
Group daemon

</IfModule>


ServerAdmin postmaster@localhost

ServerName localhost:80

<Directory />
AllowOverride all
Require all denied
</Directory>


DocumentRoot "C:/XAMPP/htdocs"
<Directory "C:/XAMPP/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride All

Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm
default.php default.pl default.cgi default.asp default.shtml default.html default.htm
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>

<Files ".ht*">
Require all denied
</Files>

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio
</IfModule>


CustomLog "logs/access.log" combined
</IfModule>

<IfModule alias_module>


ScriptAlias /cgi-bin/ "C:/XAMPP/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "C:/XAMPP/cgi-bin">
AllowOverride All
Options None
Require all granted
</Directory>

<IfModule mime_module>
TypesConfig conf/mime.types

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddHandler cgi-script .cgi .pl .asp


AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>

<IfModule mime_magic_module>
MIMEMagicFile "conf/magic"
</IfModule>






Include conf/extra/httpd-mpm.conf

Include conf/extra/httpd-multilang-errordoc.conf

Include conf/extra/httpd-autoindex.conf

Include conf/extra/httpd-languages.conf

Include conf/extra/httpd-userdir.conf

Include conf/extra/httpd-info.conf

Include conf/extra/httpd-vhosts.conf



Include "conf/extra/httpd-proxy.conf"
Include "conf/extra/httpd-default.conf"
Include "conf/extra/httpd-xampp.conf"

<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

Include conf/extra/httpd-ssl.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


AcceptFilter http none

<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-ajp.conf"
</IfModule>
</IfModule>


httpd-vhosts.conf:



<VirtualHost *:80>
ServerAdmin septagramm@gmail.com
DocumentRoot "S:/efit_rails4/public"
Alias /remote-control "S:/ssm-misc/remote-control"
<Directory "S:/efit_rails4/public">
Require all granted
AllowOverride All
</Directory>
<Directory "S:/ssm-misc/remote-control">
Require all granted
AllowOverride All
</Directory>
ServerName SSM
</VirtualHost>


bottom of error.log:



[Fri Nov 28 05:43:56.875099 2014] [mpm_winnt:notice] [pid 9780:tid 380] AH00456: Apache Lounge VC11 Server built: Jul 17 2014 11:50:08
[Fri Nov 28 05:43:56.875099 2014] [core:notice] [pid 9780:tid 380] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/XAMPP/apache'
[Fri Nov 28 05:43:56.876100 2014] [mpm_winnt:notice] [pid 9780:tid 380] AH00418: Parent: Created child process 8276
[Fri Nov 28 05:43:57.155297 2014] [ssl:warn] [pid 8276:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 28 05:43:57.255380 2014] [ssl:warn] [pid 8276:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 28 05:43:57.280385 2014] [mpm_winnt:notice] [pid 8276:tid 384] AH00354: Child: Starting 150 worker threads.
[Fri Nov 28 05:44:18.865136 2014] [authz_core:error] [pid 8276:tid 1728] [client 127.0.0.1:63898] AH01630: client denied by server configuration: S:/ssm-misc/remote-control/api/.htaccess


Update



After some persuasion (and help from @AD7six) I was able to get the debug output working. There appears to be a new-ish way to configure that:



RewriteBase /remote-control/api/


I'm weirded out by the rewrite mod seemingly rewriting the URL correctly and then promptly serving 404. Also, I tried experimenting and found out that if I add an explicit rewrite base equal to the current directory, e.g.:



RewriteBase /remote-control/api/


The rewrite sort of works - I get index.php served, though I have other errors so I can't quite confirm if it truly works. However, I'm not entirely satisfied with this as a solution. Besides, the debug output in this case is somewhat longer, as if it's making another pass or something. And in the end, it comes to an identical filename, but without 404:



[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] strip per-dir prefix: S:/ssm-misc/remote-control/api/session -> session
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] applying pattern '^' to uri 'session'
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace2] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] rewrite 'session' -> 'index.php'
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] add per-dir prefix: index.php -> S:/ssm-misc/remote-control/api/index.php
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace2] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] trying to replace prefix S:/ssm-misc/remote-control/api/ with /remote-control/api/
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace1] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] internal redirect with /remote-control/api/index.php [INTERNAL REDIRECT]
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] strip per-dir prefix: S:/ssm-misc/remote-control/api/index.php -> index.php
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] applying pattern '^' to uri 'index.php'
[Thu Dec 04 00:37:31.418478 2014] [rewrite:trace1] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] pass through S:/ssm-misc/remote-control/api/index.php


What can possibly be going on here?










share|improve this question















I'm trying to enable mod_rewrite on a XAMPP 5.6.3 installation. I've been following these guides:




  • http://www.leonardaustin.com/blog/technical/enable-mod_rewrite-in-xampp/

  • http://www.lancelhoff.com/enabling-htaccess-in-apache-on-windows/

  • https://apple.stackexchange.com/questions/47526/enable-url-rewriting-mod-rewrite-using-htaccess-files-in-sites-on-lion


...and a bunch of other I managed to google up. Unfortunately, to no avail.



I have a project that was developed under Linux, working perfectly there, having .htaccess file inside:



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]


I have tried:




  1. Making sure that the line LoadModule rewrite_module modules/mod_rewrite.so is not commented in httpd.conf.

  2. Replacing AllowOverride none with AllowOverride all in httpd.conf (2 or 3 occurrences).

  3. Adding AllowOverride all directives in all <Directory> sections I have added to httpd-vhosts.conf when the above didn't work, just in case.

  4. Restarting after changes #2 and #3.


I'm trying to access URLs in the directory with .htaccess file, but none of them presumably get rewritten probably, and give 404. Access to the file that they should be rewritten to is possible, and gives no errors. Accessing .htaccess itself gives 403.



I also tried adding:



RewriteLog "C:/XAMPP/apache/logs/rewrite.log"
RewriteLogLevel 3


...both to httpd.conf and httpd-vhosts.conf, sometimes without RewriteLog, but, when I do that, Apache refuses to start - sometimes it spits generic error messages into XAMPP console, sometimes it just hangs. It doesn't write anything at error.log though. So, no mod_rewrite debug output. phpinfo(), however, shows that the loaded modules are:




core mod_win32 mpm_winnt http_core mod_so mod_access_compat mod_actions mod_alias mod_allowmethods mod_asis mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_dav_lock mod_dir mod_env mod_headers mod_include mod_info mod_isapi mod_log_config mod_cache_disk mod_mime mod_negotiation mod_proxy mod_proxy_ajp mod_rewrite mod_setenvif mod_socache_shmcb mod_ssl mod_status mod_version mod_php5




So it should be in more or less working order.



This is driving me mad. Please help.



Below are the full contents of anything that looks remotely useful:



httpd.conf:



ServerRoot "C:/XAMPP/apache"


Listen 80

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_lock_module modules/mod_dav_lock.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule cache_disk_module modules/mod_cache_disk.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule status_module modules/mod_status.so
LoadModule version_module modules/mod_version.so

<IfModule unixd_module>
User daemon
Group daemon

</IfModule>


ServerAdmin postmaster@localhost

ServerName localhost:80

<Directory />
AllowOverride all
Require all denied
</Directory>


DocumentRoot "C:/XAMPP/htdocs"
<Directory "C:/XAMPP/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI

AllowOverride All

Require all granted
</Directory>

<IfModule dir_module>
DirectoryIndex index.php index.pl index.cgi index.asp index.shtml index.html index.htm
default.php default.pl default.cgi default.asp default.shtml default.html default.htm
home.php home.pl home.cgi home.asp home.shtml home.html home.htm
</IfModule>

<Files ".ht*">
Require all denied
</Files>

ErrorLog "logs/error.log"

LogLevel warn

<IfModule log_config_module>
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio
</IfModule>


CustomLog "logs/access.log" combined
</IfModule>

<IfModule alias_module>


ScriptAlias /cgi-bin/ "C:/XAMPP/cgi-bin/"

</IfModule>

<IfModule cgid_module>
</IfModule>

<Directory "C:/XAMPP/cgi-bin">
AllowOverride All
Options None
Require all granted
</Directory>

<IfModule mime_module>
TypesConfig conf/mime.types

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddHandler cgi-script .cgi .pl .asp


AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>

<IfModule mime_magic_module>
MIMEMagicFile "conf/magic"
</IfModule>






Include conf/extra/httpd-mpm.conf

Include conf/extra/httpd-multilang-errordoc.conf

Include conf/extra/httpd-autoindex.conf

Include conf/extra/httpd-languages.conf

Include conf/extra/httpd-userdir.conf

Include conf/extra/httpd-info.conf

Include conf/extra/httpd-vhosts.conf



Include "conf/extra/httpd-proxy.conf"
Include "conf/extra/httpd-default.conf"
Include "conf/extra/httpd-xampp.conf"

<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>

Include conf/extra/httpd-ssl.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>


AcceptFilter http none

<IfModule mod_proxy.c>
<IfModule mod_proxy_ajp.c>
Include "conf/extra/httpd-ajp.conf"
</IfModule>
</IfModule>


httpd-vhosts.conf:



<VirtualHost *:80>
ServerAdmin septagramm@gmail.com
DocumentRoot "S:/efit_rails4/public"
Alias /remote-control "S:/ssm-misc/remote-control"
<Directory "S:/efit_rails4/public">
Require all granted
AllowOverride All
</Directory>
<Directory "S:/ssm-misc/remote-control">
Require all granted
AllowOverride All
</Directory>
ServerName SSM
</VirtualHost>


bottom of error.log:



[Fri Nov 28 05:43:56.875099 2014] [mpm_winnt:notice] [pid 9780:tid 380] AH00456: Apache Lounge VC11 Server built: Jul 17 2014 11:50:08
[Fri Nov 28 05:43:56.875099 2014] [core:notice] [pid 9780:tid 380] AH00094: Command line: 'c:\xampp\apache\bin\httpd.exe -d C:/XAMPP/apache'
[Fri Nov 28 05:43:56.876100 2014] [mpm_winnt:notice] [pid 9780:tid 380] AH00418: Parent: Created child process 8276
[Fri Nov 28 05:43:57.155297 2014] [ssl:warn] [pid 8276:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 28 05:43:57.255380 2014] [ssl:warn] [pid 8276:tid 384] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Nov 28 05:43:57.280385 2014] [mpm_winnt:notice] [pid 8276:tid 384] AH00354: Child: Starting 150 worker threads.
[Fri Nov 28 05:44:18.865136 2014] [authz_core:error] [pid 8276:tid 1728] [client 127.0.0.1:63898] AH01630: client denied by server configuration: S:/ssm-misc/remote-control/api/.htaccess


Update



After some persuasion (and help from @AD7six) I was able to get the debug output working. There appears to be a new-ish way to configure that:



RewriteBase /remote-control/api/


I'm weirded out by the rewrite mod seemingly rewriting the URL correctly and then promptly serving 404. Also, I tried experimenting and found out that if I add an explicit rewrite base equal to the current directory, e.g.:



RewriteBase /remote-control/api/


The rewrite sort of works - I get index.php served, though I have other errors so I can't quite confirm if it truly works. However, I'm not entirely satisfied with this as a solution. Besides, the debug output in this case is somewhat longer, as if it's making another pass or something. And in the end, it comes to an identical filename, but without 404:



[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] strip per-dir prefix: S:/ssm-misc/remote-control/api/session -> session
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] applying pattern '^' to uri 'session'
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace2] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] rewrite 'session' -> 'index.php'
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] add per-dir prefix: index.php -> S:/ssm-misc/remote-control/api/index.php
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace2] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] trying to replace prefix S:/ssm-misc/remote-control/api/ with /remote-control/api/
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace1] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d4118/initial] [perdir S:/ssm-misc/remote-control/api/] internal redirect with /remote-control/api/index.php [INTERNAL REDIRECT]
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] strip per-dir prefix: S:/ssm-misc/remote-control/api/index.php -> index.php
[Thu Dec 04 00:37:31.417478 2014] [rewrite:trace3] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] applying pattern '^' to uri 'index.php'
[Thu Dec 04 00:37:31.418478 2014] [rewrite:trace1] [pid 5636:tid 1728] mod_rewrite.c(475): [client ::1:58668] ::1 - - [localhost/sid#f51730][rid#88d7bb8/initial/redir#1] [perdir S:/ssm-misc/remote-control/api/] pass through S:/ssm-misc/remote-control/api/index.php


What can possibly be going on here?







mod-rewrite xampp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 13 '17 at 12:45









Community

1




1










asked Dec 3 '14 at 10:11









SeptagramSeptagram

1,61841520




1,61841520




migrated from serverfault.com Dec 3 '14 at 13:45


This question came from our site for system and network administrators.






migrated from serverfault.com Dec 3 '14 at 13:45


This question came from our site for system and network administrators.










  • 1




    Are you sure you're not using apache 2.4? RewriteLog was replaced by LogLevel xxx rewrite:yyy - which would make the config invalid and apache refuse to start. You will find it easier to remove everything from the config that's irrelevant to the question (Especially commented out noise, but I don't just mean in the question - I mean on your dev machine) so as to focus on the problem. I don't see how any dev-setup problem (xampp) is relevant to serverfault - this question is more appropriate for stack overflow.
    – AD7six
    Dec 3 '14 at 13:27










  • @AD7six, you were right, and that enabled to get some debug output. I'll update the question ASAP. As for the config noise, I'll remove the commented parts today, I'm sorry for dumping all this onto community (( As for what is not connected, I won't be able to always tell what is noise and what is not.
    – Septagram
    Dec 3 '14 at 13:52














  • 1




    Are you sure you're not using apache 2.4? RewriteLog was replaced by LogLevel xxx rewrite:yyy - which would make the config invalid and apache refuse to start. You will find it easier to remove everything from the config that's irrelevant to the question (Especially commented out noise, but I don't just mean in the question - I mean on your dev machine) so as to focus on the problem. I don't see how any dev-setup problem (xampp) is relevant to serverfault - this question is more appropriate for stack overflow.
    – AD7six
    Dec 3 '14 at 13:27










  • @AD7six, you were right, and that enabled to get some debug output. I'll update the question ASAP. As for the config noise, I'll remove the commented parts today, I'm sorry for dumping all this onto community (( As for what is not connected, I won't be able to always tell what is noise and what is not.
    – Septagram
    Dec 3 '14 at 13:52








1




1




Are you sure you're not using apache 2.4? RewriteLog was replaced by LogLevel xxx rewrite:yyy - which would make the config invalid and apache refuse to start. You will find it easier to remove everything from the config that's irrelevant to the question (Especially commented out noise, but I don't just mean in the question - I mean on your dev machine) so as to focus on the problem. I don't see how any dev-setup problem (xampp) is relevant to serverfault - this question is more appropriate for stack overflow.
– AD7six
Dec 3 '14 at 13:27




Are you sure you're not using apache 2.4? RewriteLog was replaced by LogLevel xxx rewrite:yyy - which would make the config invalid and apache refuse to start. You will find it easier to remove everything from the config that's irrelevant to the question (Especially commented out noise, but I don't just mean in the question - I mean on your dev machine) so as to focus on the problem. I don't see how any dev-setup problem (xampp) is relevant to serverfault - this question is more appropriate for stack overflow.
– AD7six
Dec 3 '14 at 13:27












@AD7six, you were right, and that enabled to get some debug output. I'll update the question ASAP. As for the config noise, I'll remove the commented parts today, I'm sorry for dumping all this onto community (( As for what is not connected, I won't be able to always tell what is noise and what is not.
– Septagram
Dec 3 '14 at 13:52




@AD7six, you were right, and that enabled to get some debug output. I'll update the question ASAP. As for the config noise, I'll remove the commented parts today, I'm sorry for dumping all this onto community (( As for what is not connected, I won't be able to always tell what is noise and what is not.
– Septagram
Dec 3 '14 at 13:52










1 Answer
1






active

oldest

votes


















0














Your RewriteRule is wrong. It should look like this:



  RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,QSA]


Adjust the redirect path to suit, but you needed more than just the ^ character there.






share|improve this answer





















  • Since the capture group is not used there's absolutely no need to have one. The rewrite rule in the question simply matches all urls (as does the one in this answer, but that's because it's functionally no different). Here's something as a reference, note also that the QSA flag isn't needed if there are no query args added in the rewrite rule.
    – AD7six
    Dec 3 '14 at 13:12










  • @AD7six well, obviously what he's using isn't working for him as it's not matching, so something is definitely amiss. Then again, it is Apache on Windows, so who knows what kind of screwy setup it is.
    – Nathan C
    Dec 3 '14 at 13:14










  • Doesn't work, sorry (
    – Septagram
    Dec 3 '14 at 13:50











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f848018%2fcannot-set-up-mod-rewrite-with-xampp%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Your RewriteRule is wrong. It should look like this:



  RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,QSA]


Adjust the redirect path to suit, but you needed more than just the ^ character there.






share|improve this answer





















  • Since the capture group is not used there's absolutely no need to have one. The rewrite rule in the question simply matches all urls (as does the one in this answer, but that's because it's functionally no different). Here's something as a reference, note also that the QSA flag isn't needed if there are no query args added in the rewrite rule.
    – AD7six
    Dec 3 '14 at 13:12










  • @AD7six well, obviously what he's using isn't working for him as it's not matching, so something is definitely amiss. Then again, it is Apache on Windows, so who knows what kind of screwy setup it is.
    – Nathan C
    Dec 3 '14 at 13:14










  • Doesn't work, sorry (
    – Septagram
    Dec 3 '14 at 13:50
















0














Your RewriteRule is wrong. It should look like this:



  RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,QSA]


Adjust the redirect path to suit, but you needed more than just the ^ character there.






share|improve this answer





















  • Since the capture group is not used there's absolutely no need to have one. The rewrite rule in the question simply matches all urls (as does the one in this answer, but that's because it's functionally no different). Here's something as a reference, note also that the QSA flag isn't needed if there are no query args added in the rewrite rule.
    – AD7six
    Dec 3 '14 at 13:12










  • @AD7six well, obviously what he's using isn't working for him as it's not matching, so something is definitely amiss. Then again, it is Apache on Windows, so who knows what kind of screwy setup it is.
    – Nathan C
    Dec 3 '14 at 13:14










  • Doesn't work, sorry (
    – Septagram
    Dec 3 '14 at 13:50














0












0








0






Your RewriteRule is wrong. It should look like this:



  RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,QSA]


Adjust the redirect path to suit, but you needed more than just the ^ character there.






share|improve this answer












Your RewriteRule is wrong. It should look like this:



  RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,QSA]


Adjust the redirect path to suit, but you needed more than just the ^ character there.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 3 '14 at 13:05









Nathan CNathan C

2,38211023




2,38211023












  • Since the capture group is not used there's absolutely no need to have one. The rewrite rule in the question simply matches all urls (as does the one in this answer, but that's because it's functionally no different). Here's something as a reference, note also that the QSA flag isn't needed if there are no query args added in the rewrite rule.
    – AD7six
    Dec 3 '14 at 13:12










  • @AD7six well, obviously what he's using isn't working for him as it's not matching, so something is definitely amiss. Then again, it is Apache on Windows, so who knows what kind of screwy setup it is.
    – Nathan C
    Dec 3 '14 at 13:14










  • Doesn't work, sorry (
    – Septagram
    Dec 3 '14 at 13:50


















  • Since the capture group is not used there's absolutely no need to have one. The rewrite rule in the question simply matches all urls (as does the one in this answer, but that's because it's functionally no different). Here's something as a reference, note also that the QSA flag isn't needed if there are no query args added in the rewrite rule.
    – AD7six
    Dec 3 '14 at 13:12










  • @AD7six well, obviously what he's using isn't working for him as it's not matching, so something is definitely amiss. Then again, it is Apache on Windows, so who knows what kind of screwy setup it is.
    – Nathan C
    Dec 3 '14 at 13:14










  • Doesn't work, sorry (
    – Septagram
    Dec 3 '14 at 13:50
















Since the capture group is not used there's absolutely no need to have one. The rewrite rule in the question simply matches all urls (as does the one in this answer, but that's because it's functionally no different). Here's something as a reference, note also that the QSA flag isn't needed if there are no query args added in the rewrite rule.
– AD7six
Dec 3 '14 at 13:12




Since the capture group is not used there's absolutely no need to have one. The rewrite rule in the question simply matches all urls (as does the one in this answer, but that's because it's functionally no different). Here's something as a reference, note also that the QSA flag isn't needed if there are no query args added in the rewrite rule.
– AD7six
Dec 3 '14 at 13:12












@AD7six well, obviously what he's using isn't working for him as it's not matching, so something is definitely amiss. Then again, it is Apache on Windows, so who knows what kind of screwy setup it is.
– Nathan C
Dec 3 '14 at 13:14




@AD7six well, obviously what he's using isn't working for him as it's not matching, so something is definitely amiss. Then again, it is Apache on Windows, so who knows what kind of screwy setup it is.
– Nathan C
Dec 3 '14 at 13:14












Doesn't work, sorry (
– Septagram
Dec 3 '14 at 13:50




Doesn't work, sorry (
– Septagram
Dec 3 '14 at 13:50


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f848018%2fcannot-set-up-mod-rewrite-with-xampp%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

If I really need a card on my start hand, how many mulligans make sense? [duplicate]

Alcedinidae

Can an atomic nucleus contain both particles and antiparticles? [duplicate]