Php apache.htcaccess重定向到https
当我这样做时,我无法将登录页面重定向到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
# 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