友好的URL设置友好、URL

2023-09-02 01:14:19 作者:徒有风情

新手为镆铘革命v2.2.14-PL(SDK)我挣扎与用户友好的-URL功能:

Newbie to MODX Revolution v2.2.14-pl (sdk) I'm struggling with the User-Friendly-URL feature:

示例:

地址:本地主机/ modx_revolution / ZWEI / - >出家的内容(索引) - > 错误 地址:本地主机/ modx_revolution / zwei.html - >显示正确的内容 - > 正确 Url: localhost/modx_revolution/zwei/ --> showing 'Home' content (index) -> WRONG Url: localhost/modx_revolution/zwei.html --> showing correct content -> CORRECT

期望中的网址是没有的文件扩展名像例1

Desired URL is without the file extension like in Example 1

现在我阅读,直到缓存被清空,镆铘和放大器;浏览器,更改的页面只能由preVIEW功能,这使得在示例网址查看2

Now I read, that until the caches are emptied, MODX & Browser, the changed pages can only be viewed by the Preview function, which gives the URL under Example 2.

即使排空两个高速缓存(浏览器与镆铘)的示例的URL如1 不起作用 - >显示索引文件的内容。所以我thougt是,我的网址,设置和放大器; htaccess的是错误的莫名其妙。

Even after emptying both caches (browser & modx) The URL like in Example 1 does not work -> shows the index file content. So my thougt is that my URL-settings & htaccess are wrong somehow.

下面我镆铘友好的URL设置:

Here my MODX Friendly URL settings:

和我的的.htaccess 文件

RewriteEngine On
RewriteBase /modx_revolution/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

另外,我不得不说,我不是很熟悉的的.htaccess 命令...

修改

在@ okaynet的评论我试图改变系统设置错误页到另一页ID和我得到的网页呈现。

After @okaynet's comment I tried to change the system setting Error Page to another page ID and i get that page rendered.

如果我输入一个不存在的,我得到的,如预期,一个404错误页面ID。

If I enter a Page ID which doesn't exist, I get, as expected, an 404 Error.

编辑2

名为ZWEI从类型的ressource 文件存在,并且有一个别名 ZWEI 。这是什么意思?

The ressource named 'zwei' from type Document exists and has an alias zwei. What does that mean?

那么下一步该怎么做?

推荐答案

这捕获了很多人了:默认情况下, error_page 设置(用于返回404)是设置的主页。所以你的第一个URL可能会返回一个404未找​​到错误code,但显示的主页。

This catches a lot of people out: by default, the error_page setting (for returning 404s) is set to the home page. So your first url might be returning a 404 not found error code, but displaying the home page.

试着改变 error_page 设置为不同的页面,看看第一个URL发送你那里呢?

Try changing the error_page setting to a different page and see if the first url sends you there instead?

要删除.html扩展名,去的系统>内容类型的和清除的HTML内容类型的文件扩展列。您可能需要清除您的站点缓存这样的更改生效后。

To remove the .html extension, go to System > Content Types and clear out the File Extension column for the HTML content type. You may need to clear your Site Cache after doing this for the changes to take effect.