Alias custom symbol allow to URL MODX

195 Views Asked by At

I would like to change my home page url.

https://roto.com.ua/ua/index to https://roto.com.ua/ua/#index

Want to allow custom symbol # to pattern settings MODX. This is my current default pattern in MODX Settings. When i Try to apply to alias #index, it's rewrite to index..... Probably not allow add custom symbols to alias!

friendly_alias_restrict_chars_pattern

/[\0\x0B\t\n\r\f\a&=+%#<>"~:`@\?\[\]\{\}\|\^'\\]/
2

There are 2 best solutions below

0
On

Hashes are special in URLs. When you send a request to /ua/#index, the server only sees the /ua/ part. That means that while you may be able of convincing MODX to accept it in the alias, MODX will not be able of routing your requests properly because it doesn't see index.

0
On

Remove the hash tag from the regex should be enough.

Change this:

[\0\x0B\t\n\r\f\a&=+%#<>"~:`@\?\[\]\{\}\|\^'\\]

Into this:

[\0\x0B\t\n\r\f\a&=+%<>"~:`@\?\[\]\{\}\|\^'\\]

This allows # to be in the URL alias.