0

GitHub リポジトリをhttp://github.mydomain.com/repositorynameに自動デプレイすることができました。

現在、次のとおりです。私のプロジェクトのほとんどは、ルートにスタイルシート、javascripts などのフォルダーを持っているため、href="/css/styles.css" や src="/js/scripts.js" のようになります。これらを href="/repositoryname/css/styles.css" および src="/repositoryname/js/scripts.js" にリダイレクト/書き込みする必要があります。

私はhtaccessの経験がほとんどないので、誰かが私を助けてくれることを願っています!

ありがとう、イアソン

4

2 に答える 2

0

絶対パスではなく相対パスを使用しないのはなぜですか。これは、ディレクトリにあるプロジェクトを実行するのに役立ちます。

例:- ./js/myscript.js など。

于 2013-08-16T11:38:05.470 に答える
0

解決:

We redirect the URL / to /about/:

RewriteEngine on
RewriteRule   ^/$  /about/  [R]

Note that this can also be handled using the RedirectMatch directive:

RedirectMatch ^/$ http://example.com/about/

Note also that the example rewrites only the root URL. That is, it rewrites a request for http://example.com/, but not a request for http://example.com/page.html. If you have in fact changed your document root - that is, if all of your content is in fact in that subdirectory, it is greatly preferable to simply change your DocumentRoot directive, or move all of the content up one directory, rather than rewriting URLs.

これは、 http://httpd.apache.org/docs/trunk/rewrite/remapping.html#page-headerから取得したソリューションであり、移動された DocumentRoot 見出しを参照してください。

于 2013-08-16T12:02:47.007 に答える