Hi guys,
I am looking for a way to be able to have a customized URL in modx, but generated by scripts, not written manually in alias field of resources
more specifically, I want to build a friendly URL with my own designed format, and better in names without IDs, like this
www.domain.com/store-name.html and www.domain.com/category/product-name.html, because all these pages are build up with snippet, how would I achieve this customized URL in modx? Is there any way I can overwrite alias of URL dynamically, or using variables to build URL alias like what TV does?
Just give me some directions, it would help.
Thanks
-
☆ A M B ☆
- 2,475 Posts
You could write a plugin that fires when the document is saved and set the alias value via the code in the plugin.
I have a site where custom URLs are handled by mod_rewrite in .htaccess. Various RewriteRules extract the different parts and send them to the correct document, where a snippet then works out what to display.
Is there any advantage/disadvantage to doing it this way vs the plugin/sendForward method described in the linked post?