We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27117
    • 28 Posts
    Today, I noticed, that urls in this format are no longer working: www.mydomain.com/100.html

    It's working when I enter the url like this:

    www.mydomain.com/aliastext
    or
    www.mydomain.com?id=100

    I have some weblinks where I have entered the resource id and all these weblinks are no longer working and the user gets redirected to the homepage.

    I'm using Revo 2.2.4. I'm not shure, when this issue started but it could be since the update to 2.2.4 some weeks ago.

    Any help is appreciated [ed. note: shotup last edited this post 14 years, 2 months ago.]
      Modx 2.1.3, PHP 5.2
      • 27117
      • 28 Posts
      This is my .htaccess, maybe it helps.
      # MODx supports Friendly URLs via this .htaccess file. You must serve web
      # pages via Apache with mod_rewrite to use this functionality, and you must
      # change the file name from ht.access to .htaccess.
      #
      # Make sure RewriteBase points to the directory where you installed MODx.
      # E.g., "/modx" if your installation is in a "modx" subdirectory.
      #
      # You may choose to make your URLs non-case-sensitive by adding a NC directive
      # to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]
      
      RewriteEngine On
      RewriteBase /
      
      
      
      # Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
      #RewriteCond %{HTTP_HOST} .
      #RewriteCond %{HTTP_HOST} !^example-domain-please-change\.com [NC]
      #RewriteRule (.*) http://example-domain-please-change.com/$1 [R=301,L]
      #
      # or for the opposite domain.com -> www.domain.com use the following
      # DO NOT USE BOTH
      #
      #RewriteCond %{HTTP_HOST} .
      #RewriteCond %{HTTP_HOST} !^www\.example-domain-please-change\.com [NC]
      #RewriteRule (.*) http://www.example-domain-please-change.com/$1 [R=301,L]
      
      
      RewriteCond %{http_host} !^www\.telebaern\.tv [NC] 
      Rewriterule ^(.*)$ http://www.telebaern.tv/$1 [L,R=301]
      
      
      
      
      
      
      # Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent 
      # https://www.domain.com when your cert only allows https://secure.domain.com
      #RewriteCond %{SERVER_PORT} !^443
      #RewriteRule (.*) https://example-domain-please-change.com.com/$1 [R=301,L]
      
      
      
      # The Friendly URLs part
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
      
      #REDIRECT SUBDOMAIN TO SUBDIRECTORY OF SAME NAME
      #RewriteCond %{ENV:REDIRECT_SUBDOMAIN} =""
      #RewriteCond %{HTTP_HOST} ([a-z0-9][-a-z0-9]+)\.telebaern\.tv\.?(:80)?$ [NC]
      #RewriteCond %{DOCUMENT_ROOT}/%1 -d
      #RewriteRule ^(.*) %1/$1 [E=SUBDOMAIN:%1,L]
      #RewriteRule ^ - [E=SUBDOMAIN:%{ENV:REDIRECT_SUBDOMAIN},L]
      
      
      
      # Make sure .htc files are served with the proper MIME type, which is critical # for XP SP2. Un-comment if your host allows htaccess MIME type overrides.
      
      AddType text/x-component .htc
      
      
      
      # If your server is not already configured as such, the following directive
      # should be uncommented in order to set PHP's register_globals option to OFF.
      # This closes a major security hole that is abused by most XSS (cross-site
      # scripting) attacks. For more information: http://php.net/register_globals
      #
      # To verify that this option has been set to OFF, open the Manager and choose
      # Reports -> System Info and then click the phpinfo() link. Do a Find on Page
      # for "register_globals". The Local Value should be OFF. If the Master Value
      # is OFF then you do not need this directive here.
      #
      # IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
      #
      # Your server does not allow PHP directives to be set via .htaccess. In that
      # case you must make this change in your php.ini file instead. If you are
      # using a commercial web host, contact the administrators for assistance in
      # doing this. Not all servers allow local php.ini files, and they should
      # include all PHP configurations (not just this one), or you will effectively
      # reset everything to PHP defaults. Consult www.php.net for more detailed
      # information about setting PHP directives.
      
      php_flag register_globals Off
      
      
      
      # For servers that support output compression, you should pick up a bit of
      # speed by un-commenting the following lines.
      
      php_flag zlib.output_compression On
      php_value zlib.output_compression_level 5
      
      
      
      # The following directives stop screen flicker in IE on CSS rollovers. If
      # needed, un-comment the following rules. When they're in place, you may have
      # to do a force-refresh in order to see changes in your designs.
      
      #ExpiresActive On
      #ExpiresByType image/gif A2592000
      #ExpiresByType image/jpeg A2592000
      #ExpiresByType image/png A2592000
      #BrowserMatch "MSIE" brokenvary=1
      #BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
      #BrowserMatch "Opera" !brokenvary
      #SetEnvIf brokenvary 1 force-no-vary
      
      # CSS-JS-Booster Start #################################################
      
      #Turn ETagging off
      FileETag none
      
      #Alternative caching using Apache's "mod_headers", if it's installed.
      #Caching of common files - ENABLED
      <IfModule mod_headers.c>
      	<FilesMatch "\.(ico|pdf|js|css|gif|png|jpg|jpeg|ico|txt|html|htm)$">
      	Header set Cache-Control "max-age=2592000, public"
      	</FilesMatch>
      </IfModule>
      
      # CSS-JS-Booster End ###################################################
      
      # fopen (wird fuer ModX Package Management benoetigt) Start #################################################
      
      php_flag "allow_url_fopen" "On"
      php_flag "allow_url_include" "On"
      
      # fopen End #################################################
      

        Modx 2.1.3, PHP 5.2
        • 3749
        • 24,544 Posts
        I'm not positive, but I think URLs in that format will only occur if a resource has no alias. I think newer versions of MODX require an alias for every doc and may have trouble with older docs that have no alias.

        This utility snippet should show you pages with no alias:

        <?php
        $output = '<h3>Resources with no Alias</h3>';
        $resources = $modx->getCollection('modResource', array('alias' => ''));
        if (empty($resources)) {
        $output .= '<p>None found</p>';
        } else {
            foreach($resources as $resource) {
                $output .= '<p>Pagetitle: ' . $resource->get('pagetitle') . ' -- ID: ' . $resource->get('id'); 
            }
        }
        return $output;



        ------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using.
        MODX info for everyone: http://bobsguides.com/modx.html
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 27117
          • 28 Posts
          Thanks for your help Bob.
          But the problem is, that my weblinks are not working, when I enter the resource id in the weblink content field as mentioned in the manual. When I enter the alias, it works.

          How do you (or others) handle weblinks?
            Modx 2.1.3, PHP 5.2
            • 27117
            • 28 Posts
            It seems, that I have solved the problem.

            I think, Bob was right with this statement:
            I'm not positive, but I think URLs in that format will only occur if a resource has no alias. I think newer versions of MODX require an alias for every doc and may have trouble with older docs that have no alias.

            The problem is about weblinks with resource ids instead of alias text. This was discussed in another topic here on the forum:
            https://forums.modx.com/thread/78058/weblink-needs-link-syntax-around-target-id-if-friendly-url-is-on

            Opengeek posted a link to the solution and writes, that it will be fixed in 2.1.5-pl but I think this is wrong and it should be 2.2.5-pl. Because I'm running 2.2.4. and when I checked the code of my file, there where was the old (wrong) code.

            I just manually changed my core/model/modx/modweblink.class.php as described and now my weblinks containing resource IDs are working again.

            I hope this is useful for anyone running into the same problem.
              Modx 2.1.3, PHP 5.2