Friendly Urls Modx Revolution


I had MODX Revolution installed by my hosting provider and subsequently I seem to have two ht.access files. One is located in the manager folder and the other is independent on its own. I have been trying endlessly to set up Friendly Urls on my site but every time I go to rename the ht.access file to .htaccess it will not let me and says the file format is not supported. Any advice on this issue will be greatly appreciated.

Step to reproduce

How to reproduce the issue, including custom code if needed.

Observed behavior

How it behaved after following the steps above. Annotated screenshots here are excellent.

Expected behavior

How it should behave after following the steps above.


MODX Revolution 2.7.1-pl

Where are you trying to rename it? I’m not sure if you’ll be able to do that in the MODX manager using the file manager, but you should be able to rename it using FTP or command line

When I try to rename it through MODX Manager this is the error that pops up.

Yeah you’ll need to edit the filename using FTP. If you have to use the file manager though then I think you can go into system settings and search for allowed file types and add a .htaccess file as an allowed file type, then you may be able to rename it.

How would I edit the filename using FTP?

Navigate to the file via ftp using a client (such as flashfxp or filezilla) and then just right click -> rename

Thanks that seemed to work. It’s now been renamed to .htaccess. I now just need to check if I can get the Friendly Urls to work now.

When I add <base href= "[[!++site_url]]" /> to my page templates it makes the page dissapear and the url hasn’t changed.

Sounds and looks like it’s trying to find your assets in the wrong place. Try inspecting an image and see what the path is that it’s trying to locate it.

In general they should be declared as <img src="assets/images/image.jpg"> as base href returns something like

I checked the path and it is correct. Could there be an issue with the .htaccess file that could be causing the issue?

So the template works without the

<base href="[[!++site_url]]" /> , but does not with it?

Check in Modx system settings to make sure site_url is set right

That’s correct. What should I look out for in the system settings to make sure site_url is set correct?

Hi I am sorry, I made a mistake, it seems there is no system setting involved, my mistake. I’m a bit confused about that, but I went into my install and couldn’t find it.

I don’t think this has anything to do with htaccess, because the extra code I don’t think would affect things…actually not sure about that.

Now you can check for errors on your page using some online html checkers, that can help. Additionally, in your browser you can open ‘developer’s tools’ and this will give you a console where you can see the parts of the page loading, if something is wrong there could be error messages in there

But that code should work, could you paste your entire template to see what is going on?

Also, pls try using an extremely basic template, that base url code has to get in there somehow

Click the gear icon in the manager and then select 'System Settings" it will be the first option in the drop down menu.

Aftder that loads you’ll see a series of button menus called “core” “None” “search by key”

Select None and then select “Friendly URLs” from the drop down menu.

Once that section opens there will be a host of settings for you to play around with.

The main one you wnat is “Use Friendly URL’s” Set it to Yes.

See this Doc for further details

I tried using one of my most basic pages and it seems to knock out all images for some reason. Text, menus and buttons all appear fine is just images it doesn’t like and also the URL doesn’t change it’s still /index.php?id=114

I’ve checked the settings and cross matched it with the one provided in the link and it looks like I have all the correct settings set.

What’s the output of an image path in your source code? What steps do you need to take in your browser inspector to make it link to the correct image?

Ensure you’ve also cleared your cache both for modx and your browser

All images have the same source code of I’ve also cleared both caches

I mean if you right click on the image source in the code and go open in a new tab it doesn’t open the image does it? What do you need to edit in the address bar to correctly navigate to it?

That’s correct. It returns this error

Not Found

The requested URL / was not found on this server.

Apache/2.4.39 (Unix) Server at Port 80

Does your image source have a ‘/’ at the start of the source?

<img src="/assets/images/image.jpg">

instead of

<img src="assets/images/image.jpg">

Forward slash denotes the root directory