Friendly Urls in 2 folders deep = 404 (Apache settings were wrong)

Hi all,

I’m really sorry to be asking this. (truely am, 'cause I know this sort of thing would continue to crop up - but I did look for answers).

I’ve got Modx3 installed and working fine with 2 extras - Ace and VersionX.

I have modx installed here:

So I’m working through this folder for management:

I’ve used friendly urls plenty of times, but this time it’s not wanting to play.

I have in my template

I have updated the correct .htaccess file in the /core/ path to have the
RewriteBase /folder1/folder2/

I have turned on Friendly URLs in the settings, yet I’m still getting the 404.

This is the first time I’ve done it 2 folders deep from the main URL.

Am I missing something?
Could be be a CHMOD or CHOWN permission problem?

I only have 2 resources. id=1 and id=2.
When I go to hit ‘View’ on a resource, modx points me to the ‘html’ alias name associated with each resources.

And, I’m getting nothing in the /cache/log/ path

I’m presently running on php7.4.33 as well. (surely that wouldn’t be the problem though).

I’m a bit stuck this time. It’s a bit weird.


Hey @vrdriver

I could be wrong I’m not sure that this is necessary.

Have you renamed the ht.access file in your root [] to .htaccess?

I’ve just deployed a fresh MODX installation two folders deep and all seems OK.

All I did was enable Friendly URLs in System Settings and rename the root ht.access file.

Oops, I wrote that wrong didn’t I?

Yes, I have updated the .htaccess file in the /folder1/folder/ path.

I’m glad it worked for you. I’ll keep digging…

Does it work if you request the URL

If that works, then the problem is the .htaccess file in /folder1/folder2/.

Ah, now we are getting somewhere. Yes, that did work with the ?q parameter.


Now to figure out what’s going on with the .htaccess file.

Unfortunately, it’s the bog standard

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

# Prevent rewrite the .well-known directory used by LetsEncrypt by rules below of this rule
RewriteRule "^\.well-known/" - [L]

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

# Force rewrite to https for every host
#RewriteCond %{HTTPS} !=on [OR]
#RewriteCond %{SERVER_PORT} !^443
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# 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 %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

# 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

No idea why it doesn’t work.

Are you sure you’re on an Apache Server where .htaccess works and not on Nginx?
Also, maybe check the RewriteBase line for a typo.

Well it’s morning again here in Australia. Maybe I’ll try installing it on the root path and see what happens. ta.

Man I hate computers sometimes. The server was ignoring the .htaccess files. This problem certainly wasn’t on my Apache bingo card.

But there you go… usually it’s the obvious things, other times, it’s a deeper problem. The joys of running a VPS.

For others in this situation, this document help me out to diagnose and fix the problem.

I had to change the default setting in the httpd.conf to the following, with the ’ AllowOverride All’ setting being the key thing:

<Directory "/var/www/html">    
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

Thanks guys for your swift suggestions though! :slight_smile:

1 Like

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.