Using Absolute Paths for resources

I am having some issues with internal redirections using htacess. Its been pointed out that rules arent working because the local resources should use absolute paths anb they are using relative ones.

I can control most of them myself. Except for css and the js generated by webcore.

Could we please looking at making them absolute, or having a property to control it ?

Absolute paths make web apps not deployable to other servers, switchable between servers, ... so I'm not sure it is good idea to introduce this inflexible option.

Some paths should be absolute such as the main javascript file and main css. Others can be relative. I fail to see a scenario where the javascript containing rtl should be relative. At the moment, I will have to keep editing the index.html every time. And when I miss, the site will malfunction.

I'm sorry, then I obviously fail to see or understand what exactly you need and why.
Also, our code is only adding something to your app's main HTML file when you use "Manage JavaScript Libraries". After something is added, our code doesn't change this HTML file anymore.

I'm curious about what you've got setup for deploying your project? Actually somewhat hard for me to imagine a scenario where anything other than relative paths makes any sense? But having to edit the index.html site every time is absolutely a problem that needs to be addressed in some way.

I imagine normally that all the files in a project end up in the 'release' folder and any references are included there as well. So a CSS or JS file might be added to a css or js folder, but still be a subfolder within the release folder. When it comes time to publish the new version of the project, the contents of the release folder are simply copied to a webserver, along with any subfolders and their contents. No changes at all to any files, index.html or otherwise is normally necessary.

But that's not the case for you for some reason? Which seems like it would also be harder for you to test your development work - if there are additional dependencies or links to other things, for example, that are not in your project directly already.

@AndrewSimard Having recently sold my company, I am bootstrapping and decided to write my website in tmswebcore as a learning exercise. It also stops me messing around with javascript. I have used PHP in the past which leaves a gap which I intend to fill with a Rest Server.

This is the Web Site if you want to peruse it. I am using Beyond Compare to copy the files over which is upto 10 times a day at present. Only because CORS stuffs up how much I can test locally.

Here is the Stack Overflow Post that suggests a solution.

I have many domains and subdomains getting redirected. And because I only have one executable (javascript file), unlike say a PHP system, I have to map real world urls to params. These are global at the moment, so the users can see them. These should be local redirections. Which means that not all relative resource paths work. For some combinations of https / http / www /no www / domains / subdomains, the user sees the index page but it does not run the rtl. I can only fix this by making the path to the main js file absolute. Because I am using auto-increment for version, I have to be a little more careful (if I am to do this).

I have asked the web hosting company for help and the company that issued the certificates. And there is no other suggestion. I havent switched over to using the a fixed path for the index page. But I am in the process of changing all other paths to absolute, (where they can be absolute).

The pros and cons of absolute vs relative paths is here apache - .htaccess rewrite URL leads to missing CSS - Webmasters Stack Exchange

Here's the relevant re-direction potion of the htaccess. Its not finished yet as I still have to have to handle 4 other domains properly. The trickiest one being .app because Google restricts what it does.

RewriteEngine on

RewriteCond %{HTTP_HOST} ^pacificblue\.app$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.pacificblue\.app$ [NC,OR]
RewriteCond %{HTTP_HOST} ^pacificblue\.kiwi$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.pacificblue\.kiwi$ [NC,OR]
RewriteCond %{HTTP_HOST} ^pacificblue\.nz$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.pacificblue\.nz$ [NC,OR]
RewriteCond %{HTTP_HOST} ^pacificblue\.online$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www\.pacificblue\.online$ [NC]
RewriteRule ^$1 [R=302,L]

RewriteCond %{HTTP_HOST} ^$
RewriteRule ^contacts$\?mode\=contacts&%{QUERY_STRING}  [R=302,L]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^credits$\?mode\=credits&%{QUERY_STRING}  [R=302,L]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^downloads$\?mode\=downloads&%{QUERY_STRING}  [R=302,L]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^developer$\?mode\=developer&%{QUERY_STRING}  [R=302,L]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^projects$\?mode\=projects&%{QUERY_STRING}  [R=302,L]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(download)/([^/]+)$$1&name=$2 [L]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(payment)/([^/]+)$$1&name=$2 [L]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(donation)/([^/]+)$$2 [L]

Header always set Content-Security-Policy "upgrade-insecure-requests;"
Header append X-Frame-Options: "SAMEORIGIN"

I like to automate things, to avoid human errors. So if I have to, I might write a processor for the files(s), Its a big post, but I wanted to avoid lots of tos and fros :-)

Pretty sure I spend waaay more time messing around with javascript now than I ever did before!

As for your redirect problem, that's moderately unpleasant for sure. I'd have to brush up on my Apache htaccess skills to help more with that, but I think it can deal with having changing version numbers with some creative rule writing.

What is in the index.html that you'd have to be changing all the time though? You can put in a leading / or whatever you need to properly identify where you're putting the files, but you'd only have to do that one time, wouldn't you?

You must be fighting it. I fought it for a while. Now I just get around what limitations I come up with. The only javascript I have had to put in was for linking to paypal-donate and google-tag-manager. Especially now that there's so much more you can do with css.

I have not tried it yet, you may be right. I had assumed that since it was autoincrementing the version it would replace the whole path every time. BTW it would be nice if it versioned the main css as well. That requires a few keystrokes everytime to convince the browser to reload a fresh copy.

So a suggestion @brunofierens - How about a version variable that I could append to other files as necessary.

To be fair, I have spent more time fiddling with CSS than I have with JS. But hardly the way to go to avoid JS I'd think. Glad that you've been able to though!

The version is just a string that is in the Project.html file. You can see where it is in the file, and just add stuff around it, like a leading / or a /directory/ or whatever you need to be sure it is looking where you want it to be looking.

The same might also work for the CSS file, where you can just append the project to it? Maybe try something like:

<link href="/css/mystyle.css?ver=$(ProjectName)" rel="stylesheet"/>

And see if that helps with that sort of thing. I find I'm still doing browser hard refreshes all the time anyway, even to get the latest javascript to load, but that's the general idea. You'd not want to leave that there beyond the development work though as you'd like the CSS to be cached. At least once it stops getting changed every five minutes :roll_eyes: