MODX中的友好URL重定向到主页 [英] Friendly URL in MODX redirects to home page

查看:96
本文介绍了MODX中的友好URL重定向到主页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MODX Revolution v2.2.14-pl(sdk)的User-Friendly-URL功能来消除URL中的.html扩展名.一个已经干净的URL重定向到主页,而不是显示正确的页面.为什么第一个URL重定向到主页?

I'm trying to use the User-Friendly-URL feature of MODX Revolution v2.2.14-pl (sdk) to eliminate the .html extension from the URL. An already clean URL redirects to the home page rather than showing the correct page. Why does the first URL redirect to the home page?

  1. /modx_revolution/zwei/显示主页"页面
  2. /modx_revolution/zwei.html显示正确的页面
  1. /modx_revolution/zwei/ shows 'Home' page
  2. /modx_revolution/zwei.html shows correct page

我已经读到,在清空MODX和浏览器缓存之前,只能使用预览"功能查看更改的页面,该功能提供了示例2中的URL.即使在清除两个缓存之后,第一个URL也无法正常工作.我认为URL设置或htaccess不正确.

I've read that until the MODX and Browser caches are emptied the changed pages can only be viewed with the Preview function, which gives the URL from Example 2. Even after cleaning both caches the first url does not work. I think that the URL-settings or htaccess are wrong somehow.

MODX友好的URL设置:

MODX Friendly URL settings:

friendly_urls: true
friendly_urls_strict: true
use_alias_path: true

.htaccess:

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

推荐答案

这吸引了很多人:默认情况下,error_page设置(用于返回404)被设置为主页.因此,您的第一个网址可能返回未找到的404错误代码,但显示了主页.

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.

这篇关于MODX中的友好URL重定向到主页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆