问题
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?
/modx_revolution/zwei/
shows 'Home' page/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