Robert
Robert

Reputation: 925

Mod Rewrite Htaccess works on some and not on others on WAMP

I am in the middle of transferring one of my very old websites from PHP 5.5 > PHP 7.3

On the older version of WAMP, the URL rewrites work fine, but on the latest version, they are not working as expected.

I am testing it on the latest version of WAMP and I have mod_rewrite on within the Apache server.

All works well on all the moded URL's apart from a few, here are the few that do not work:

Options +FollowSymlinks
RewriteEngine On

RewriteRule ^Control-Panel/Pages/Add/?$ Control-Panel/pages.php?mode=add [L]
RewriteRule ^Control-Panel/Pages/Edit/([0-9]+)/?$ Control-Panel/pages.php?mode=edit&pid=$1 [L]
RewriteRule ^Control-Panel/Pages/Manage/?$ Control-Panel/manage-pages.php [L]
RewriteRule ^Control-Panel/Pages/Menu/?$ Control-Panel/menu.php [L]

Now the code that is more or less the same but does work with no errors are:

RewriteRule ^page/([A-Za-z0-9-]+)/?$ pages.php?slug=$1 [L]
RewriteRule ^page/([A-Za-z0-9-]+)/page-([0-9]+)/?$ pages.php?slug=$1&pagenumber=$2 [L]

RewriteRule ^portfolio/([A-Za-z0-9-]+)/([0-9]+)/?$ portfolio-single.php?slug=$1&pid=$2 [L]

The only thing I can think of is that the Apache servers are acting differently because of the version they are running.

My wamp on the old version is running Apache 2.4.9 My wamp on the new version is running Apache 2.4.37

Has mod rewriting changed since the older version?

Upvotes: 0

Views: 31

Answers (1)

Robert
Robert

Reputation: 925

Ok for anyone who is also getting this, it's because MultiViews is automatically enabled when installing WAMP.

Within the .htaccess file open and find:

Options

It should be at the top of the file, and just simply add the following to it.

-MultiViews

If you for some reason your options has +MultiViews, then remove it.

Save the file and restart the apache server.

Upvotes: 1

Related Questions