Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如果.htaccess文件写入正确,则服务器中的404错误不是本地主机中的错误_Css_Apache_.htaccess_Cakephp - Fatal编程技术网

Css 如果.htaccess文件写入正确,则服务器中的404错误不是本地主机中的错误

Css 如果.htaccess文件写入正确,则服务器中的404错误不是本地主机中的错误,css,apache,.htaccess,cakephp,Css,Apache,.htaccess,Cakephp,cakephp/app/.htaccess <IfModule mod_rewrite.c> RewriteBase / RewriteEngine on # Uncomment if you have a .well-known directory in the app folder, e.g. for the Let's Encrypt challenge # https://tools.ietf.org/html/rfc5785 #Rew

cakephp/app/.htaccess

<IfModule mod_rewrite.c>
    RewriteBase /
    RewriteEngine on
    # Uncomment if you have a .well-known directory in the app folder, e.g. for the Let's Encrypt challenge
    # https://tools.ietf.org/html/rfc5785
    #RewriteRule ^(\.well-known/.*)$ $1 [L]
    RewriteRule ^$ webroot/ [L]
    RewriteRule (.*) webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
    RewriteBase /
    RewriteEngine on
    # Uncomment if you have a .well-known directory in the root folder, e.g. for the Let's Encrypt challenge
    # https://tools.ietf.org/html/rfc5785
    #RewriteRule ^(\.well-known/.*)$ $1 [L]
    RewriteRule ^$ app/webroot/ [L]
    RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
        RewriteBase /
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

重写基/
重新启动发动机
#如果应用程序文件夹中有.well-known目录,请取消注释,例如,对于Let's Encrypt挑战
# https://tools.ietf.org/html/rfc5785
#重写规则^(\.well-known/*)$$1[L]
重写规则^$webroot/[L]
重写规则(.*)webroot/$1[L]
cakephp/.htaccess

<IfModule mod_rewrite.c>
    RewriteBase /
    RewriteEngine on
    # Uncomment if you have a .well-known directory in the app folder, e.g. for the Let's Encrypt challenge
    # https://tools.ietf.org/html/rfc5785
    #RewriteRule ^(\.well-known/.*)$ $1 [L]
    RewriteRule ^$ webroot/ [L]
    RewriteRule (.*) webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
    RewriteBase /
    RewriteEngine on
    # Uncomment if you have a .well-known directory in the root folder, e.g. for the Let's Encrypt challenge
    # https://tools.ietf.org/html/rfc5785
    #RewriteRule ^(\.well-known/.*)$ $1 [L]
    RewriteRule ^$ app/webroot/ [L]
    RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
        RewriteBase /
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

重写基/
重新启动发动机
#如果根文件夹中有.well-known目录,请取消注释,例如,对于Let's Encrypt挑战
# https://tools.ietf.org/html/rfc5785
#重写规则^(\.well-known/*)$$1[L]
重写规则^$app/webroot/[L]
重写规则(*)app/webroot/$1[L]
cakephp/app/webRoot/.htaccess

<IfModule mod_rewrite.c>
    RewriteBase /
    RewriteEngine on
    # Uncomment if you have a .well-known directory in the app folder, e.g. for the Let's Encrypt challenge
    # https://tools.ietf.org/html/rfc5785
    #RewriteRule ^(\.well-known/.*)$ $1 [L]
    RewriteRule ^$ webroot/ [L]
    RewriteRule (.*) webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
    RewriteBase /
    RewriteEngine on
    # Uncomment if you have a .well-known directory in the root folder, e.g. for the Let's Encrypt challenge
    # https://tools.ietf.org/html/rfc5785
    #RewriteRule ^(\.well-known/.*)$ $1 [L]
    RewriteRule ^$ app/webroot/ [L]
    RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
<IfModule mod_rewrite.c>
        RewriteBase /
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

重写基/
重新启动发动机
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^index.php[L]
还启用了模式_重写。路径也正确,然后服务器也给出404 not错误

<link href="css/bootstrap.min.css" rel="stylesheet">


    <link href="/css/metisMenu.min.css" rel="stylesheet">


    <link href="/css/timeline.css" rel="stylesheet">


    <link href="/css/sb-admin-2.css" rel="stylesheet">


    <link href="/css/morris.css" rel="stylesheet">


没有任何css和js文件正在加载。只有cakephp css正在加载。我将文件的所有权更改为root,并且我已将775文件权限授予app/tmp。我犯了一个错误,我是cakephp新手。在cakephp中,所有css js文件都应放在app/webroot中,但我将它们放在了根文件夹中webroot www可以访问它。感谢您的帮助。

请检查服务器上是否存在
.htaccess
文件,有时它们会作为隐藏文件丢失“只有cakephp css正在加载”-
cakephp.css
(?)在您发布的代码中甚至没有引用?
cakephp
cakephp/.htaccess
中的子目录吗?如果是这样,那么您发布的
.htaccess
文件不会影响您的CSS URL?除了第一个是相对的。是的,我也检查了。htaccess文件也存在于服务器中。我将webroot的权限更改为775 alsono它不是一个子目录。所有内容都在本地完美运行。但是css和js没有加载到服务器中。您请求的URL是什么?那么,
cakephp
是文档的根吗?在您的本地环境中,是否具有相同的目录结构?在您发布的所有3个
.htaccess
文件中,您都设置了
RewriteBase/
——这看起来不正确(但在本地测试时可能也会失败??)。