【发布时间】:2020-02-01 19:09:03
【问题描述】:
我使用 Apache 网络服务器,我想将所有 url 从 ip 重定向到域。这是我网站.htaccess文件的内容:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\. [NC,OR]
RewriteCond %{HTTPS} !on
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L,NE]
Options -Indexes
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([\s\S]*)$ index.php?rt=$1 [L,B,QSA]
根据一些研究,我想我需要这样的东西:(不确定)
RewriteBase /
RewriteCond %{HTTP_HOST} ^95\.216\.161\.63$
RewriteRule ^([\s\S]*)$ https://lamtakam.com/$1 [L,R=301]
但我不知道应该如何(在哪一部分)将这三行添加到.htaccess 文件中。有什么线索吗?
【问题讨论】:
标签: apache .htaccess redirect ip