尽管在Wamp工作中

发布于 2025-02-09 19:21:50 字数 414 浏览 3 评论 0原文

我想重写网站的URL,在Wamp中,这项工作非常好,但是当我安装Xamp时,这不起作用。

在我的文件.htaccess中,

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

当我在本地主机中打开项目时,它显示了报告“通知:未定义的索引:c:\ xampp \ htdocs \ htdocs \ admaposta \ admaposta \ index.php在第6行上”,也向其他变量发送给其他变量。 。

我已经搜索了答案,而我的httpd.conf在所有内容和行中都有“允许的”。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月静好 2025-02-16 19:21:50

您会出现错误报告,如果您不想看到它,则应关闭,此外,重写可能正在起作用,但您仍然存在一些错误,这可能不会引起初始问题,但假设已设置了变量。

您甚至可以在您的php-settings中发出警告;
或只需将其添加到您的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安装进行检查。
有关WAMPP安装的设置,请参见php.ini文件,然后更改XAMPP安装中的php.ini。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文