1

Recently on a new PC I installed AppServ.

As always, I started developing a script in PHP previously having configured the .htaccess file

This is the situation:


.htaccess

RewriteEngine On

RewriteRule ^step/token/([a-zA-Z0-9_-]+)/?$   step.php?load=page&page=reset-token&token=$1   [L,QSA]


step.php

print_r($_GET)


Test #1

If I load the URL

http://localhost/mod-rewrite/step.php?load=page&page=reset-token&token=123

This is the output:

Array ( [load] => page [page] => reset-token [token] => 123 )


Test #2

If I load the URL with the desired format

http://localhost/mod-rewite/step/token/123/

The issue

Array ( )


In C:\AppServ\Apache2.2\conf\httpd.conf

LoadModule rewrite_module modules/mod_rewrite.so Does not start with #

And AllowOverride is All

<directory />
    Options FollowSymLinks
    AllowOverride All
    order deny,allow
    Deny from all
</directory>


What can be happening?

armate1hernan
  • 105
  • 1
  • 8
  • Is the output from test #2 actually from your `step.php` file? – Phil Feb 13 '17 at 23:56
  • Yes, step.php is the only php file in that directory – armate1hernan Feb 14 '17 at 00:01
  • Do you have any other redirects? You may also need to [disable `MultiViews`](http://stackoverflow.com/questions/25423141/what-exactly-does-the-the-multiviews-options-in-htaccess) – Phil Feb 14 '17 at 02:07
  • If I add **Options -MultiViews** in .htaccess, then step.php It does not load anymore, in that case index.php is load – armate1hernan Feb 14 '17 at 02:48
  • Ok, that's progress. That means that your rewrite rule is not matching correctly. Is your `.htaccess` file in the `mod-rewrite` directory along with `step.php`? – Phil Feb 14 '17 at 02:53
  • Yes, in the folder "mod-rewrite" there are now only 3 files: .htaccess, step.php and index.php – armate1hernan Feb 14 '17 at 02:55

1 Answers1

0

The solution is to put to the beginning of .htaccess "Options -MultiViews"

Then restart services

Thanks to @Phil

armate1hernan
  • 105
  • 1
  • 8