Magento 管理 URL 不起作用:更改后出现 404,无法返回

发布于 2024-12-01 16:16:03 字数 768 浏览 1 评论 0原文

我一直在浏览所有主题以找到与我的案例类似的内容。我发现了一些类似的案例,但没有一个解决方案能解决我的问题。

我通过后端更改了管理网址。保存更改后,magento 直接将我带到 404 错误。我为管理 url 定义的新 url 是“gestion”。访问 mydomain.com/gestion,收到 404 错误。

因此,我决定返回删除在 magento core_config_data 表上创建的新条目,然后手动清空缓存目录。

但之后我遇到了同样的错误:404页面未找到。我已经尝试过这个这个< /a>.但还是一样。

奇怪的是,我已经删除了数据库中与“gestion”相关的所有内容,并清空了缓存目录。但是当我访问 mydomain.com/admin 时,magento 将我重定向到 mydomain.com/gestion (出现 404 错误)。

当我删除了与此相关的所有内容后,为什么 magento 将我重定向到“gestion”?我还应该去哪里寻找解决这个问题的方法?

PD Magento 1.5.1

I've been looking through all the topics to find something similar to my case. I've found a few similar cases, but none of the solutions solved my problem.

I changed through the backend the admin url. After saving changes, magento took me directly to a 404 error. The new url I defined for the admin url was "gestion". Going to mydomain.com/gestion, gets a 404 error.

So I decided to go back deleting the new entries that were created on the magento core_config_data table and then emptied manually the cache directory.

But after that I've got the same error: 404 page not found. I've tried this and this. But still the same.

The weird thing is that I've deleted everything related to "gestion" on the database and also emptied the cache directory. But when I go to mydomain.com/admin, magento redirects my to mydomain.com/gestion (with a 404 error).

Why is magento redirecting me to "gestion" when I've removed everything related to that? Where else should I look to solve this?

P.D. Magento 1.5.1

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

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

发布评论

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

评论(8

泪痕残 2024-12-08 16:16:03

答案:
我遇到了同样的问题,之前的答案都不适合我。我正在使用 Magento 1.9 版本。

这是我解决该问题的方法...

  1. 转到您的 cpanel 并启动 phpMyAdmin
  2. 找到您的 Magento 数据库并选择 core_config_data 表。
  3. 找到并编辑以下行:
    • 范围:“默认”和路径:“admin/url/custom”
      • 选中NULL复选框并保存。
    • 范围:“默认”和路径:“admin/url/use_custom”
      • 将值从 1 更改为 0 并保存。
    • 范围:“默认”和路径:“admin/url/use_custom_path”
      • 将值从 1 更改为 0(如果尚未更改)并保存。
  4. 找到并删除以下行:
    • 范围:“商店”和路径:“web/secure/base_url”
    • 范围:“商店”和路径:“web/unsecure/base_url”
      (应位于最后一页)
  5. 删除 /var/cache 文件夹

,您就完成

转到您之前的管理网址,它应该可以工作!

ANSWER:
I had the same issue and none of previous answers worked for me. I'm using Magento Version 1.9.

Here's what i did to fix the issue...

  1. Go to your cpanel and launch phpMyAdmin.
  2. Locate your Magento Database and select the core_config_data table.
  3. Locate and edit the following rows:
    • Scope:"Default" and Path:"admin/url/custom"
      • Select the NULL checkbox and save.
    • Scope:"Default" and Path:"admin/url/use_custom"
      • Change value from 1 to 0 and save.
    • Scope:"Default" and Path:"admin/url/use_custom_path"
      • Change value from 1 to 0 if it isn't already and save.
  4. Locate and delete the following rows:
    • Scope:"Stores" and Path:"web/secure/base_url"
    • Scope:"Stores" and Path:"web/unsecure/base_url"
      (should be located on the last page)
  5. Delete /var/cache folder

and you're DONE!

go to your previous admin url and it should work!

初吻给了烟 2024-12-08 16:16:03

以下是针对系统配置自定义管理 URL 陷阱的修复。它从来没有奏效过,而且可能永远不会奏效。更改它的唯一方法是通过 local.xml 更改路由

https://magento.stackexchange.com/a/40622 /553

对于任何打开管理基本 URL 的人来说,这里有一种方法可以在您执行任何搞乱系统的其他操作之前杀死它。

启动 phpMyAdmin 并打开您的 core_config_data 表。您有四行或更多行需要编辑。

找到 admin/url/custom 并设置为 0

接下来的三个将根据您在管理配置面板中设置的时髦管理基本 URL 进行设置。您知道它是什么,下面的行将在值字段中包含它。记下它们的 config_ID 编号并将其写下来。

管理/网址/自定义
以及所有实例
网络/不安全/base_url
web/secure/base_url

将这些设置为您的网站不安全的基本网址。示例:http://yourwebsite.com/ 如果您安装在该文件夹,请不要忘记后跟斜杠的文件夹。

编辑:刷新/var/cache 和/var/session。

这应该允许您现在通过将 /admin 附加到您的网站网址来登录管理面板,就像您开始冒险之前一样。转到您的高级管理设置。 使用自定义管理将设置为否。从自定义管理 URL 字段中清除 URL 并保存。当您返回并检查 phpMyAdmin 中的 core_config_data 表时,您应该只会发现 admin/url/custom 行仍设置为 0,admin/url/custom 行为空白,其他两行消失了因为它们是通过管理面板保存删除的。

这样做的原因是您需要删除正确的 web/unsecure/base_urlweb/secure/base_url 行。如果您得到了错误的信息,您的网站前端将被完全禁用,而不仅仅是失去管理后端。

编辑:现在您已经备份了网站,请返回并确保您拥有正确的 secure_base_url 以恢复 TLS/SSL 功能。

这一切都已在开发服务器 YMMV 上进行了测试

Here's the fix for the System Config Custom Admin URL booby trap. It's never worked, and probably never will. The only way to change it is to change the route through local.xml

https://magento.stackexchange.com/a/40622/553

And for anyone who turns Admin Base URL on, here's a way to kill it before you do anything else which WILL mess your system up.

Fire up phpMyAdmin and open your core_config_data table. You have four or more rows to edit.

Find admin/url/custom and set to 0

The next three will have been set from the funky Admin Base URL you set in the Admin Config panel. You know what it is, the following rows will have it in the value field. Note their config_ID numbers and write them down.

admin/url/custom
and all instances of
web/unsecure/base_url
web/secure/base_url

Set these to be what your website unsecured base url should be. Example: http://yourwebsite.com/ and don't forget the folder followed by a slash if you installed there.

EDIT: Flush /var/cache and /var/session.

This should allow you to log into your Admin panel now by appending /admin to your website url as like before you got adventurous. Go to your Advanced Admin setup. Use Custom Admin will be set to No. Clear the URL from the Custom Admin URL field and save. When you go back and check your core_config_data table in phpMyAdmin, you should only find the admin/url/custom row still set to 0, the admin/url/custom row blanked, and the other two rows gone as they were deleted through the admin panel save.

The reason for doing it this way is that you need to get the right web/unsecure/base_url and web/secure/base_url rows deleted. If you get the wrong ones, your website frontend gets completely disabled instead of just losing the admin backend.

EDIT: Now that you have your website back up, go back and make sure you have the correct secure_base_url to get your TLS/SSL capabilities back.

This has all been tested on a dev server, YMMV

沫离伤花 2024-12-08 16:16:03

在尝试一切方法解决问题后,我发现 /var 目录没有正确的权限。 Magento 在 /tmp 上写入,因此清空 magento 根目录上的 /var/cache 目录没有任何效果。

我们修复了权限并刷新了 /tmp 目录,一切都恢复正常。所以,是 /var 权限导致了问题。

现在,当发生类似的事情时,我们需要考虑另一件事。

谢谢你们的帮助,伙计们。

After trying everything to fix the problem I found out that the /var directory didn't have the correct permissions. Magento wrote on /tmp so there was no effect emptying the /var/cache directory on the magento root.

We fixed the permissions and flushed the /tmp directory and everything went back to normal. So, it was the /var permissions that caused the problem.

Now we have another thing to take into account when something like this happens.

Thanks for your help, guys.

苍暮颜 2024-12-08 16:16:03

要解决此问题,请从 phpMyAdmin 运行以下查询

UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

To fix the issue run the following query from phpMyAdmin

UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;
一袭水袖舞倾城 2024-12-08 16:16:03

只是想在这里补充一点,即使您遵循 Magento 论坛帖子上的所有步骤: http: //www.magentocommerce.com/boards/viewreply/274443/ 它可能仍然无法工作 - 默认管理 URL 仍然会出现错误。

对我来说,这是因为 /var/log 目录没有设置异常。log &系统日志文件。因此,在执行完

$ mkdir var/log
$ touch var/log/system.log
$ touch var/log/exception.log
$ chmod -R g+w var/log

(更改最后一个 chmod 以匹配本地 Web 服务器的权限要求)

之后,默认管理 url 就起作用了。因此,如果您按照所有数据库步骤进行操作但仍然没有结果,请尝试创建日志文件和日志文件。确保它们可由 Web 服务器写入。

Just wanted to add here that, even if you follow all the steps on the Magento forum post: http://www.magentocommerce.com/boards/viewreply/274443/ it may still not work - the default admin URL still gives an error.

For me that was because the /var/log directory was not set-up with exception.log & system.log files. So after doing

$ mkdir var/log
$ touch var/log/system.log
$ touch var/log/exception.log
$ chmod -R g+w var/log

(Change the last chmod to match your local web server's permission requirements)

Then the default admin url worked. So if you follow all the db steps through and still no dice, try creating the log files & ensure they are writable by the web server.

忆依然 2024-12-08 16:16:03

然而,更多的混乱又增加了:

以上都没有帮助我;我的magento版本是1.7.0.1。 这个网站确实帮助了我。如果您不小心使用管理后端将管理更改为自定义 URL(就像我所做的那样),您将需要 MySql 访问权限来修复它。

仅仅更改键 admin/url/use_customadmin/url/custom 是不够的。即使我更改了app/etc/local.xml,我尝试的任何操作都无法返回管理界面。

我使用了诸如 select * from core_config_data where path like '%url%'; 之类的查询来查看更大的图片:

// much data omitted...

+-----------+---------+-------------------------------+----------------------------+
| config_id | scope   | path                          | value                      |
+-----------+---------+-------------------------------+----------------------------+
|         3 | default | web/unsecure/base_url         | http://example.com/        |
|         4 | default | web/secure/base_url           | https://example.com/       |
|           |         |                               |                            |
|       745 | default | admin/url/use_custom          | 1                          |
|       746 | default | admin/url/custom              | https://example.com/oops/  |
|           |         |                               |                            |
|      1538 | stores  | web/secure/base_url           | https://example.com/oops/  |
|      1539 | stores  | web/unsecure/base_url         | http://example.com/oops/   |
|      1540 | default | admin/url/use_custom_path     | 0                          |
+-----------+---------+-------------------------------+----------------------------+

注意我的 ids 1538 & 。 1539. 这些随着 admin/url/custom 设置一起改变。改回 admin/url/custom 和 admin/url/use_custom` 让我登录到 admin,然后在 oops 自定义管理 url 上登录 404。

因此,我将所有这些恢复到之前的状态:

+-----------+-------------------------------+-----------------------+
| config_id | path                          | value                 |
+-----------+-------------------------------+-----------------------+
|         3 | web/unsecure/base_url         | http://example.com/   |
|         4 | web/secure/base_url           | https://example.com/  |
|           |                               |                       |
|       745 | admin/url/use_custom          | 0                     |
|       746 | admin/url/custom              |                       |
|           |                               |                       |
|      1538 | web/secure/base_url           | https://example.com/  |
|      1539 | web/unsecure/base_url         | http://example.com/   |
|      1540 | admin/url/use_custom_path     | 0                     |
+-----------+-------------------------------+-----------------------+

...然后更改了 app/etc/local.xml 并能够返回到我的网站。

为了清除 admin/url/custom,我使用了
update core_config_data set value='' where config_id = 746;

And yet more confusion to be added to the mix:

None of the above helped me; my magento version is 1.7.0.1. This website did help me. If you DO accidentally use the admin backend to change the admin to a custom URL (like I did) you will need MySql access to fix it.

Simply changing the keys admin/url/use_custom and admin/url/custom aren't enough. Even when I changed app/etc/local.xml nothing I tried will work to get back into the admin interface.

I used a query such as select * from core_config_data where path like '%url%'; to see the bigger picture:

// much data omitted...

+-----------+---------+-------------------------------+----------------------------+
| config_id | scope   | path                          | value                      |
+-----------+---------+-------------------------------+----------------------------+
|         3 | default | web/unsecure/base_url         | http://example.com/        |
|         4 | default | web/secure/base_url           | https://example.com/       |
|           |         |                               |                            |
|       745 | default | admin/url/use_custom          | 1                          |
|       746 | default | admin/url/custom              | https://example.com/oops/  |
|           |         |                               |                            |
|      1538 | stores  | web/secure/base_url           | https://example.com/oops/  |
|      1539 | stores  | web/unsecure/base_url         | http://example.com/oops/   |
|      1540 | default | admin/url/use_custom_path     | 0                          |
+-----------+---------+-------------------------------+----------------------------+

Notice my ids 1538 & 1539. These get changed along with the admin/url/custom setting. Changing back admin/url/custom and admin/url/use_custom` let me log in to admin and then 404 on the oops custom admin url.

So I put all of these back to how they were before:

+-----------+-------------------------------+-----------------------+
| config_id | path                          | value                 |
+-----------+-------------------------------+-----------------------+
|         3 | web/unsecure/base_url         | http://example.com/   |
|         4 | web/secure/base_url           | https://example.com/  |
|           |                               |                       |
|       745 | admin/url/use_custom          | 0                     |
|       746 | admin/url/custom              |                       |
|           |                               |                       |
|      1538 | web/secure/base_url           | https://example.com/  |
|      1539 | web/unsecure/base_url         | http://example.com/   |
|      1540 | admin/url/use_custom_path     | 0                     |
+-----------+-------------------------------+-----------------------+

... then went and changed app/etc/local.xml and was able to get back into my site.

To clear admin/url/custom, I used
update core_config_data set value='' where config_id = 746;

涫野音 2024-12-08 16:16:03

以下是调试此问题的最佳步骤。

  1. 打开Mage_Core_Controller_Varien_Front,位于magento/app/code/core/Mage/Core/Controller/Varien/Front.php

  2. 转到 getRouterByRoute($routeName) 函数

  3. 在这里放置此代码 print_r($this->_routers);exit;
  4. 它将为您提供所有加载的模块和控制器路径,从这里您可以检查您的模块路径是否是加载正确与否。
  5. 如果您的模块未在此处正确加载,您必须在模块中的 config.xml 中进行更改。

Following are the best step to debug this.

  1. Open Mage_Core_Controller_Varien_Front which is at magento/app/code/core/Mage/Core/Controller/Varien/Front.php

  2. Go to getRouterByRoute($routeName) function

  3. Here put this code print_r($this->_routers);exit;
  4. It will give you all loaded modules and controller path from here you can check if your module path is loaded correctly or not.
  5. If your module is not loaded correctly here you have to make changes in config.xml in your module.
小嗲 2024-12-08 16:16:03

我在安装 Magento 2 时遇到了同样的问题。问题很可能与 apache2 重写有关。另一种可能性是您的 Magento 目录的文件权限设置。我想分享两个对我有用的解决方案。

解决方案1(如果已经安装)

在本地主机上安装Magento 2时,如果您在Magento安装的步骤3中使用“localhost”而不是127.0.0.1“您的商店地址”和“Magento管理地址”字段,现在您可以做什么在 core_config_data 表中更改以下 2 行:

web/unsecure/base_url 更改为 http://127.0.0.1/Magento/

web/secure/base_url 到 https://127.0.0.1/magento2/
删除 Magento/var/cache 目录中的所有内容。

然后尝试,

http://127.0.0.1/Magento/index.php/admin/

或者

http://127.0.0.1/Magento/admin/

解决方案 2

尝试使用以下 url 中提到的权限设置重新安装 Magento:
http://devdocs.magento.com/guides/v2 .0/install-gde/prereq/zip_install.html

在安装设置向导中,第 3 步在您的商店地址中使用 127.0.0.1 而不是“localhost”。

此步骤中要考虑的另一件事:
展开高级选项并取消选中“Apache Rewrites”选项。

完成安装过程并尝试解决方案 1 中提到的管理 URL。

I had the same issue while installing Magento 2. Most probably the issue is with the apache2 rewrite. Another possibility is your file permission settings for your Magento directory. I would like to share 2 solutions that worked for me.

Solution 1(if already installed)

While installing Magento 2 on your localhost, if you used "localhost" instead of 127.0.0.1 "Your store address" and "Magento admin address" fields in step 3 of Magento installation, now what can you do is in core_config_data table change following 2 rows:

web/unsecure/base_url to http://127.0.0.1/Magento/

and

web/secure/base_url to https://127.0.0.1/magento2/
Delete everything inside the Magento/var/cache directory.

Then try,

http://127.0.0.1/Magento/index.php/admin/

or

http://127.0.0.1/Magento/admin/

Solution 2

Try reinstalling Magento with the permission settings mentioned in the below url:
http://devdocs.magento.com/guides/v2.0/install-gde/prereq/zip_install.html

In the Setup wizard for installations, step 3 use 127.0.0.1 in the your store address instead of the "localhost".

Another thing to consider in this step:
expand Advanced Options and uncheck the 'Apache Rewrites' option.

Complete the installation procedure and try the admin urls mentioned in Solution 1.

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