RewriteRule issue
Posted by: MBourne (
Date: March 04, 2019 10:22AM

(I posted this on StackExcahnge but got no responses. Hoping someone here can suggest a solution.)

I want to enter localhost/expl/admin/add-edit-category/ and have it process localhost/expl/admin/add-edit-category.php

The following .htaccess works fine on two different production servers, but results in a 404 on localhost (Wampserver 3.1.3, Apache 2.4.33, PHP 7.1.16)

RewriteBase /expl/
RewriteRule ^admin/([A-Za-z0-9-]+)/?$ /expl/admin/$1\.php [QSA,NC,L]
However, if I do something like this, it's fine on Wampserver:

Enter: localhost/expl/dummy-dir/admin/add-edit-category/

RewriteRule ^([A-Za-z0-9-]+)/admin/([A-Za-z0-9-]+)/?$ /expl/admin/$2\.php?dir=$1 [QSA,NC,L]
It will read the variables just fine and everything works as expected. So why is the first case falling over?

Another related issue (which is resulting in "too many redirect" errors) is localhost already allows entering URIs without file extensions, so e.g.

localhost/expl/admin/add-edit-category in the address bar processes

but I don't want it to do so (it's not how it works on the production servers and I need it to be consistent on my local machine). I can't find any settings in Wampserver that cause this, so I haven't been able to edit it.

Options: ReplyQuote
Re: RewriteRule issue
Posted by: Otomatic (Moderator)
Date: March 04, 2019 10:56AM


The first thing to do is to check that the Apache and PHP versions as well as the loaded Apache modules and PHP extensions are the same between the production server and the local server.

In addition, it would be necessary to:
- Verify that all VC ++ packages are installed and with the latest versions.
To do this, use the tool:
Checks VC++ packages installed
Do not use a previously loaded tool. Make a new download to make sure you are using the correct version.
To download missing packages, do not rely on Microsoft links, they are not reliable, download packages on in section Visual C++ Redistribuable Packages
Do not forget that if you have a 64 bit Windows, you must install both 32 and 64 bit versions of each package.
You must install each package "as an administrator", so right-click the exe file and then run as Administrator.

- Apply Update 3.1.7 to your version of Wampserver
Wampserver update 3.1.7

> Enter: localhost/expl/dummy-dir/admin/add-edit-category/
The second thing to do - but which must be the main one - is to do as with hosting providers, i. e. to use VirtualHost:
see The need for Virtual Host and Wampserver 3 - Create or add a VirtualHost

Wampserver 3.1.9 32 bit - Apache 2.4.39 - PHP 7.3.5/7.2.18/7.1.29/7.0.33/5.6.40 - MySQL 5.7.26 - MariaDB 10.3.15
Wampserver 3.1.9 64 bit - Apache 2.4.39 - PHP 7.3.5/7.2.18/7.1.29/7.0.33/5.6.40 - MySQL 5.7.26/8.0.16 - MariaDB 10.3.15
PhPMyadmin 4.8.5 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Edited 1 time(s). Last edit at 03/04/2019 10:59AM by Otomatic.

Options: ReplyQuote
Re: RewriteRule issue
Posted by: MBourne (
Date: March 05, 2019 09:14PM

Thank you for your help. I did what I could from your list of suggestions, but the behaviour persisted.

In the meantime, someone responded to my same question on Stackexchange and suggested turning off Multiviews in httpd-vhosts.conf, and that fixed both issues.

Options: ReplyQuote

Sorry, only registered users may post in this forum.