Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/27.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
Php apache.htcaccess重定向到https_Php_Apache_.htaccess - Fatal编程技术网

Php apache.htcaccess重定向到https

Php apache.htcaccess重定向到https,php,apache,.htaccess,Php,Apache,.htaccess,当我这样做时,我无法将登录页面重定向到https: # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{HTTPS} off RewriteRule ^login https://sklep.galmet.com.pl/login [L,R=301] # otherwise

当我这样做时,我无法将登录页面重定向到https:

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{HTTPS} off
RewriteRule ^login https://sklep.galmet.com.pl/login [L,R=301]

# otherwise forward it to index.php
RewriteRule . index.php

当我转到
shop.abcdomain.com.pl/logn
im重定向到
https://shop.abcdomain.com.pl/logn
但是像
.css
.jpeg
等所有文件都没有加载,我想这是因为这一行
重写规则。index.php
但我不知道如何解决这个问题

在开始时将所有资产(css/js)文件链接到“/”,它应该可以正常工作。

将它添加到apache.htcaccess文件中

1选项如下符号链接

2. - 选项+多视图

重写条件将仅适用于它所涉及的第一条规则。。因此,对文件/目录的检查不适用于不传递到index.php。试试这个:

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{HTTPS} off
RewriteRule ^login https://sklep.galmet.com.pl/login [L,R=301]

# otherwise forward it to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php

资产的前缀是
/
,我明白了。您能否提供部分源代码(在页面呈现后。如何准确引用资产?)。我相信这与路径有关。当我第一次使用它的时候,我也遇到了同样的问题。当我添加这个时,我的网站不可用。我想你并不真的需要第一套RewriteCond-F这里很多余P