...每当我尝试像SITE_NAME . '/includes/js/...'
这样简单的事情时,我最终会遇到http://localhost/SITE_NAME/SITE_NAME/includes/js/..
无论如何通过Joomla进行配置?我已经尝试了所有的东西,但看起来,由于某种原因,我的机器上的路径系统被打破了。我不确定它是Joomla,还是仅仅是我的配置。如果不是Joomla,有人会知道如何配置吗?
更新
不仅如此,通过我的机器指定的相对路径拒绝进入我网站的文档根路径。例如,如果不指导该路径导致"../../path/to/file"
,我就无法SITE_NAME/path/to/file
。相反,它只会引用http://localhost/path/to/file
。当然,我收到了404。
更新
此外,当我尝试向服务器发出http://
请求时,我会得到相同的结果,但现在的结果是http://localhost/somesite.com
;
更新
我将发布一个完整的例子,说明我得到的内容:
(来自Chrome中的控制台调试器):
GET http://localhost/patention/%3C%22http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js;%22 404 (Not Found)'
我还会发布我所拥有的.htaccess
(我对此一无所知)。
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
#
# mod_rewrite in use
RewriteEngine On
########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)
# RewriteBase /
########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
答案 0 :(得分:1)
您是否尝试包含文件(来自php)或想要在输出中添加某种链接? 如果要包含文件,则应执行以下操作:
INCLUDE JPATH_ROOT . DS . 'my' . DS . 'folder' . DS . 'myfile.php';
但是,如果您想要的是,例如,要在您的文件中添加脚本,您应该采用以下方式之一(两者都应该有效):
<a href="<?php echo JUri::root() . 'includes/js/myfile.js'"> ....
或
<a href="/includes/js/myfile.js">...
只要/ includes包含在你的joomla根目录中,第二个选项就可以正常工作。 如果它仍然无法正常工作,您是否可以发布一个代码示例,您尝试使用该“包含”?
我希望它有所帮助!