Force relative URLs
In my example project, the values for the src and href attributes have unfortunately been assigned inconsistently. This is due to the fact that it is an older Joomla project, which has apparently undergone changes in the meantime due to plugins and components.
Here are a few examples:
- http://example.com/images/image_1.jpg
- https://example.com/images/image_2.jpg
- example.com/images/image_3.jpg
- www.example.com/images/image_4.jpg
- /images/image_5.jpg
It affects not only images, but also regular HTML links and results in the directory structure in the target directory becoming redundant.
project_folder\index.html
project_folder\_www.example.com\index.html
Could we introduce a parameter that merges all these URLs and enforces relative paths?
--force-relative-urls
Reference should be made to the domain in the --url parameter and only apply to the following URLs:
^(https?:\/\/)?(www\.)?example\.com\/.*|^\/.*
Of course, you could also allow a regex as a parameter, but these cases should be rare:
--force-relative-urls-regex='^(https?:\/\/)?(www\.)?example\.com\/.*|^\/.*'
What do you think?
Hi @GitHub-Mike,
yes, the addition of this functionality is useful and I have thought about something similar during development.
But I want to release a new version of the whole application in a few days and implementing this will not be trivial, so I will implement it after the new year.