Heim  >  Fragen und Antworten  >  Hauptteil

Mod-Override in Xampp funktioniert nicht, obwohl es in Wamp funktioniert

Ich möchte die URL meiner Website umschreiben. In Wamp funktioniert das gut, aber wenn ich Xamp installiert habe, funktioniert es nicht.

In meiner Datei .htaccess habe ich das

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

Wenn ich das Projekt in localhost öffne, wird der Bericht „Hinweis: Undefinierter Index: q1 in C:xampphtdocsadmapostaindex.php in Zeile 6“ zusammen mit anderen Variablen angezeigt.

Ich habe nach Antworten gesucht und alles in meiner httpd.conf hat „AllowOverride All“ und die Zeile „LoadModule rewrite_module module/mod_rewrite.so“ ist unkommentiert.

P粉638343995P粉638343995251 Tage vor448

Antworte allen(1)Ich werde antworten

  • P粉752290033

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

    您打开了错误报告,如果您不想看到它,应该将其关闭,重写也可能有效,但仍然有一些错误,这可能不会导致初始问题,但假设变量已设置。

    您甚至可以在 PHP 设置中关闭警告; 或者只是将其添加到您的 php 文件中以不显示它。

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

    来源:“注意:未定义的变量”,“注意:未定义的索引”、“警告:未定义的数组键”和“注意:未定义的偏移量”使用 PHP

    由于这是新安装,您可能需要调整 XAMPP 安装并检查 WAMPP 安装使用了哪些设置。 请参阅 php.ini 文件以了解 wampp 安装的设置,并更改 xampp 安装中的 php.ini。

    Antwort
    0
  • StornierenAntwort