search

Home  >  Q&A  >  body text

Mod override in xampp doesn't work although it works in wamp

I want to rewrite the url of my website, in wamp this works fine, but when I have xamp installed this doesn't work.

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=&q2=&q3=&q4=&q5=%5

When I open the project in localhost it shows the report "Note: Undefined index: q1 in C:\xampp\htdocs\admaposta\index.php on line 6" along with other variables.

I've searched for answers and everything in my httpd.conf has "AllowOverride All" and the "LoadModule rewrite_module module/mod_rewrite.so" line is uncommented.

P粉638343995P粉638343995317 days ago508

reply all(1)I'll reply

  • P粉752290033

    P粉7522900332024-01-17 14:08:51

    You have error reporting turned on, you should turn it off if you don't want to see it, the override may also work, but there will still be some errors, which may not cause the initial problem, but assuming the variable is set.

    You can even turn off warnings in PHP settings; Or just add it to 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: "Caution: undefined variable", "Caution: undefined index", "Warning: undefined array key" and "Caution: undefined offset" using PHP

    Since this is a new installation, you may need to adjust the XAMPP installation and check what settings are used by the WAMPP installation. See the php.ini file for settings for wampp installations, and change php.ini in xampp installations.

    reply
    0
  • Cancelreply