我设法将我的GitHub存储库自动播放到http://github.mydomain.com/repositoryname。
现在以下内容:我的大多数项目在根目录中都有样式表,javascripts等文件夹,所以像href =“/ css / styles.css”和src =“/ js / scripts.js”。我希望这些将/ -write重定向到href =“/ repositoryname / css / styles.css”和src =“/ repositoryname / js / scripts.js”。
我对htaccess没什么经验,所以我希望有人帮助我!
谢谢, Iason的
答案 0 :(得分:0)
为什么不使用相对路径而不是绝对pat.This帮助您运行任何目录中的项目。
例如: - ./js/myscript.js等。
答案 1 :(得分: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,请参阅Moved DocumentRoot标题。