Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.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
Html 将.htaccess设置为不将文件访问到目录_Html_Css_Wordpress_.htaccess_Redirect - Fatal编程技术网

Html 将.htaccess设置为不将文件访问到目录

Html 将.htaccess设置为不将文件访问到目录,html,css,wordpress,.htaccess,redirect,Html,Css,Wordpress,.htaccess,Redirect,我对htaccess文件有一些问题。我为我的网站创建了一个移动版本。我的主要网站是wordpress,我为它的移动版创建了一个响应性html网站,我在从手机上查看html网站时遇到了一些问题。所以我需要学习两件事 假设我的移动站点在 1) 我如何编辑.htaccess文件,以便只使用地址访问网站,而不使用index.html 2) 当我用一些模拟器尝试我的网站时,它看起来很完美,但当我从手机打开example.com/mobile/index.html时,它只显示纯html,没有css/js。为

我对htaccess文件有一些问题。我为我的网站创建了一个移动版本。我的主要网站是wordpress,我为它的移动版创建了一个响应性html网站,我在从手机上查看html网站时遇到了一些问题。所以我需要学习两件事

假设我的移动站点在

1) 我如何编辑.htaccess文件,以便只使用地址访问网站,而不使用index.html

2) 当我用一些模拟器尝试我的网站时,它看起来很完美,但当我从手机打开example.com/mobile/index.html时,它只显示纯html,没有css/js。为什么会这样

提前谢谢


希望我足够清楚。

你能提供链接吗?如果我理解正确:

1) 在你的.htaccess文件中试试这个

RewriteEngine On
# Check for mime types commonly accepted by mobile devices
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^ http://www.example.com/mobile%{REQUEST_URI} [R,L]

2) 指向CSS和JS文件的链接可能不正确-这就是为什么您可能只看到原始HTML。

lkyardimigimizmir.com/mobile/index.HTML是移动版本。添加我在#1中建议的编辑是否对重定向有效?对于第#2项,页面似乎对我来说加载正常。实际上,我并没有寻找javascript重定向。我需要的是用.htaccess文件来做。更新的答案-试试看。