点域到IP
我在CentOS上创建了Apache服务器,并配置了整个环境。我已经完成了将IP指向域的部分,甚至激活了SSL证书(让我们加密),并且有效,但是有些事情出了问题。例如,当我单击域上的屏幕上的任何链接时,URL会自动转到我的IP,而不是继续域。当我尝试访问domain.com/wp-admin时,也会发生同样的情况,将其重定向到IP/WP-ADMIN。我认为这是一些基本的配置,但我在这部分中是初学者,因此,如果有人能提供帮助,我将不胜感激!
vhosts:
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/html/wordpress
ErrorLog /var/www/example.com/log/error.log
CustomLog /var/www/example.com/log/requests.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.mydomain.com [OR]
RewriteCond %{SERVER_NAME} =mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
I created an apache server on Centos and configured the entire environment. I've already done the part of pointing the IP to the domain and even activated the SSL certificate (Lets Encrypt) and it worked, but some things are going wrong. For example, when I click on any link on the screen on my domain, the URL automatically goes to my IP instead of continuing on the domain. The same happens when I try to access domain.com/wp-admin, it is redirected to IP/wp-admin. I think it's some basic configuration but I'm a beginner in this part so if anyone can help I'll be grateful!
Vhosts:
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot /var/www/html/wordpress
ErrorLog /var/www/example.com/log/error.log
CustomLog /var/www/example.com/log/requests.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.mydomain.com [OR]
RewriteCond %{SERVER_NAME} =mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于默认的conf文件(将所有请求重定向到您的域中):
对于您的域conf文件:
for default conf file (redirects all request to your domain with https):
And for your domain conf file: