0

I want to rewrite the url of my site, in wamp this work very well, but when I installed the xamp this not worked.

in my file .htaccess i have this

RewriteEngine On
RewriteRule ^([A-Za-z0-9-]+)/?([A-Za-z0-9-]+)?/?([A-Za-z0-9-]+)?/?$ ./index.php?q1=$1&q2=$2&q3=$3&q4=$4&q5=%5

when I open the project in my localhost it shows the report "Notice: Undefined index: q1 in C:\xampp\htdocs\admaposta\index.php on line 6" and also to the other variables.

I've already search for answers and my httpd.conf have "AllowOverride All" in everything and the line "LoadModule rewrite_module modules/mod_rewrite.so" is not commented.

1 Answers1

0

You got error reporting on and should be turned off if you do not want to see it, also the rewrite might be working but you still have some errors, which may not cause initial problems but assume variables are set.

You could even turn of the warnings in you PHP-settings; or just add this in your php file to not show it.

// not the best solution, but works
// in your php setting use, it helps hiding site wide notices
error_reporting(E_ALL ^ E_NOTICE);

Source: "Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP

Since this is a new installation you might want to adapt your installation of XAMPP and check with your WAMPP installation what settings are used. see the php.ini file for the settings of your wampp installation and change the php.ini in your xampp installation.

Jasper Lankhorst
  • 1,860
  • 1
  • 16
  • 22