Multi-site Friendly-URL Issues (links render, but don't work)


I’m unable to get my friendly-URLs working on my MODX multi-site. I have a feeling I am doing something wrong with my htaccess file. :disappointed: Maybe I need to create all the FURL settings in my context? :thinking:

Step Taken

This was a multi-faceted problem partially being solved over a long period of time, but I have got everything working except the friendly-URLs. That said, I can’t exactly remember what I have all done / where I’m at…I know I’m here:

  • System settings set
    • automatic_alias: Yes
    • friendly_urls: Yes
    • use_alias_path: Yes
  • Context settings set
    • automatic_alias: Yes
    • base_url: /
    • defualt_media_source: 2
    • friendly_urls: Yes
    • http_host:
    • site_url:
    • use_alias_path: Yes
  • htaccess set
    • RewriteCond %{HTTP_HOST} ^domain1\\.com
    • RewriteCond %{HTTP_HOST} ^domain2\\.com
    • RewriteCond %{REQUEST_FILENAME} !-f
    • RewriteCond %{REQUEST_FILENAME} !-d
    • RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
  • Cache cleared
  • Base href changed
    • <base href= "[[!++site_url]]" />


  • Images and files are working, and have correct relative paths
  • Site links are rendering, but do not function
    • Should be something like:
  • Only the IDs work for navigating /index.php?id=1337
  • Both sites appear to be working fine otherwise


  • MODX v2.7.1
  • Apache v2.4.39

Does anyone have any ideas for fixing the links? What did I miss?

Does it get fixed for a specific resource if you edit it (and/or its parent resource) in the manager and save? If so, it might be a case of needing to generate URIs. There’s a menu item Manage > Clear Cache > Refresh URIs that can help do that for all resources at once.

If that doesn’t work, can you try removing the first two RewriteCond statements (for the host) from your htaccess? I’ve not seen that used like that and wonder if that might be off.

Thanks for your time @markh.

No, the refresh URI does not solve my issue. The links appear to be rendering on the page, but when I click them they don’t work. That said though, the links are not following the folder structure.

  • Site links are rendering, but do not function
  • Should be something like:

I removed the RewriteCond for both domains. It appears to have been nonsense. :wink: It does not seem to have made any difference.

Whilst there, I did notice that all but what I previously mentioned, and the following are commented out in the htaccess:

  • RewriteEngine On
  • RewriteBase /
  • RewriteRule "/\.|^\.(?!well-known/)" - [F]

Any other thoughts? :grimacing:

Let’s pls see your full htaccess, I mean the uncommented out parts, if possible

For sure, here you go @nuan88:

# 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 /

# Prevent dot directories (hidden directories like .git) to be exposed to the public
# Except for the .well-known directory used by LetsEncrypt a.o
RewriteRule "/\.|^\.(?!well-known/)" - [F]

# Rewrite -> -- used with SEO Strict URLs plugin
#RewriteCond %{HTTP_HOST} .
#RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
#RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
# or for the opposite -> use the following
#RewriteCond %{HTTP_HOST} !^$
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteCond %{HTTP_HOST} (.+)$
#RewriteRule ^(.*)$ https://www.%1/$1 [R=301,L] .

# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent 
# when your cert only allows
#RewriteCond %{SERVER_PORT} !^443
#RewriteRule (.*)$1 [R=301,L]

# Redirect the manager to a specific domain - don't rename the ht.access file
# in the manager folder to use this this rule
#RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
#RewriteCond %{REQUEST_URI} ^/manager [NC]
#RewriteRule ^(.*)$$1 [R=301,L]

# The Friendly URLs part
#RewriteCond %{HTTP_HOST} ^domain1\.com
#RewriteCond %{HTTP_HOST} ^domain2\.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# 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:
# 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.
# 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 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

Here is my current html, seems I’ve got extra lines, might be useful

# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]

I also notice I have these lines near the top, might be relevant

Options All -Indexes
Options +FollowSymlinks

1 Like

@nuan88, your a genius! I owe you one.

So, I added these to my main htaccess, it did nothing…but I remembered my multi-site mess…I have different htaccess files for each site-folder in MODX…I put your code there and BOOM, it’s working!

So the rendered links are now working as expected:

But, it should be something like:

Am I missing a setting?

1 Like

Is your “Use Friendly Alias Path” in the system settings set to yes ?

1 Like

Always trying to help :wink: Let’s get this fixed!

Isn’t it possible to hide a folder in links using a flag on the resource? Check your articles resource and see if you’ve hidden it in menus.

To be clear, and I could be wrong, but in each resource you can click the option to hide from menus, that might explain the loss if you will of the articles folder, I am not sure though

1 Like

Earlier I do think we got confirmation of this setting, but its still extremely helpful for you to chime in and hit the key settings that are at issue here.

Thanks for the input, let’s see how it works out, cheers!

@paulp, Yes, I double checked. Both my contexts and system settings did have “use_alias_path” set to yes.

@nuan88, you did it AGAIN!

Editing the folder, in the settings tab, I checked the “Use current alias in alias path” box, this did the trick. :sunglasses: I would have never guessed that this checkbox was here…or even existed???

Thank you so much for your help. Do you have a PayPal? I’d love to buy you a drink.

1 Like

Great news! No worries, everyone here helps!

Yes, Modx has a lot of functions that can pop up in different places. Sometimes people want to hide the folder completely, or just want a simpler url, so this function is on every resource.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.