我的网站开放的IP,但我需要重定向IP到域名。
我用Laravel框架创建项目。
我的服务器是Ubuntu16.04
我的.htaccess是: //这个文件是根文件夹
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [R=301,QSA,NC,L]
RewriteCond %{HTTPS_HOST} ^10\.10\.10\.10
RewriteRule (.*) https://website.com/$1 [R=301,L]
</IfModule>
但这个密码不适用于我。
谢谢
发布于 2017-03-18 11:13:36
以这种方式:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS_HOST} !^website\.com$ [NC]
RewriteRule ^ https://website.com%{REQUEST_URI} [R=301,L,NE]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://website.com%{REQUEST_URI} [L,R=301,NE]
发布于 2018-08-12 10:51:36
只需在http.conf file
的末尾写。ip重定向到<Virtualhost *:80>
下的域名
<VirtualHost *:80>
ServerName < Server_hostname >
ServerAlias *
Redirect / https://< Server_hostname >/
</VirtualHost>
##https://ip redirection to domain name under the <Virtualhost *:443>
<VirtualHost *:443>
ServerName < Server_hostname >
ServerAlias *
Redirect / https://< Server_hostname >/
</VirtualHost>
https://stackoverflow.com/questions/42873457
复制相似问题