Friendly URL in MODX redirects to home page

空扰寡人 提交于 2019-12-13 11:27:32

问题


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/ shows 'Home' page
  2. /modx_revolution/zwei.html shows correct page

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 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]

回答1:


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.

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

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.



来源:https://stackoverflow.com/questions/23322757/friendly-url-in-modx-redirects-to-home-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!