apache - 如何从 www 重定向我的网站。通过在 htaccess 文件中进行更改来访问 http?
问题描述
谁能帮我将我的网站从 www.dipscoochbehar.com 重定向到http://dipscoochbehar.com
这是我在 htaccess 文件中写的:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /agarwalmaheswari/index.php [L]
RewriteRule www.dipscoochbehar.com /var/www/html/demosite/DIPS/index.html [R=301,L]
RewriteRule http://www.dipscoochbehar.com /var/www/html/demosite/DIPS/index.html [R=301,L]
</IfModule>
# END WordPress
我收到以下错误:这是我尝试访问网站时在控制台中遇到的错误
<html>
<head>
<title>
500 Internal Server Error
</title>
</head>
<body>
<h1>Internal Server Error</h1>
<p>
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
</p>
<p>
Please contact the server administrator at
webmaster@localhost to inform them of the time this error occurred,
and the actions you performed just before this error.
</p>
<p>
More information about this error may be available
in the server error log.</p>
<hr>
<address>
Apache/2.4.18 (Ubuntu) Server at www.dipscoochbehar.com Port 80
</address>
</body>
</html>
解决方案
此外,避免在 WordPress 部分中添加重定向规则
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.dipscoochbehar\.com$
RewriteRule ^(.*)$ http://dipscoochbehar.com/$1 [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /agarwalmaheswari/index.php [L]
</IfModule>
# END WordPress
推荐阅读
- android - classcastexception - 尝试实现 toptoche searchablespinner
- angular - 在 angular-cli 库项目中使用别名设置 scss 路径
- elasticsearch - 在弹性搜索中存储嵌套对象
- php - 如何使用php备份mysql数据库
- vue.js - 带有keyCode和条件的Vuejs keyup事件触发
- java - 如何在屏幕上正确显示单选按钮以及其他元素?(附图片)- 使用 NetBeans 的 Java GUI
- azure - 使用 azure 功能服务总线触发器读取 SB 消息
- java - Spring Cloud Stream消费者负载均衡策略
- javascript - 如何使用 Nashorn 在 Java 桌面上运行 Firebase JS SDK?
- wpf - 处理运行时添加的控件的事件