Mod override in xampp doesn't work although it works in wamp
P粉638343995
P粉638343995 2024-01-16 22:06:14
0
1
483

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粉638343995
P粉638343995

reply all(1)
P粉752290033

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!