繁体   English   中英

JPATH指定“ localhost / var / www”

[英]JPATH specifies “localhost/var/www”

...并且每当我尝试一些简单的操作(如SITE_NAME . '/includes/js/...' SITE_NAME . '/includes/js/...'我最后看到的是http://localhost/SITE_NAME/SITE_NAME/includes/js/..

无论如何,可以通过Joomla进行配置吗? 我已经尝试了所有方法,但由于某种原因,看来机器上的通路系统已损坏。 我不确定是Joomla,还是我的配置。 如果不是Joomla,有人知道如何配置吗?

更新

不仅如此,通过我的机器指定的相对路径也拒绝将其输入我网站的文档根路径。 例如,我不能在没有引导该路径到SITE_NAME/path/to/file情况下执行"../../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

您是要包含文件(来自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根目录中,第二个选项就可以正常工作。 如果仍然无法使用,您可以在其中尝试使用该“包含”的代码示例吗?

希望对您有所帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM