Web開発者が親戚のURLを避けるべき理由についての記事を読んでいましたが(http://yoast.com/relative-urls-issues)、同じディレクトリ階層のどこかに格納されているスクリプトへのajax呼び出しなどについてはどうでしょうか。 ?
相対URLが「まだ使用されている」理由の1つは、
Relative URLs are often used because developers have a test environment on another
hostname and it makes it easy for them to move stuff between their test environment and
their live environment. Other reasons include that it’s “just easier in website
maintenance”. They’re also, in my opinion falsely, promoted by some websites about site
speed because they’re “shorter” and thus “faster”.
これが主に私がそれらを使用している理由です。アプリケーションを別の場所に移動することにした場合、すべてのURLを慎重に置き換えてすべてのスクリプトを実行する必要があるため、エラーが発生しやすいようです。
ディスカッショントピックを回避するために、複数のjsファイルとphpファイルに数十の相対リンクが分散している可能性がある場合に、どうすれば相対リンクを効果的に回避できますか?