显示两次url,激活后出现404个错误

时间:2013-12-27 作者:user3131603

我已激活我的站点的SSL

例如,在我的wordpress多站点上,当我输入正确的url时,会出现404个错误http://site.org/wp-admin 它会自动重定向和发送https://site.org/wp-adminwp-admin

中是否有需要添加或删除的代码。htaccess代码来修复此问题?

2 个回复
SO网友:cowgill

听起来像您的Apache httpd。conf缺少端口443的虚拟主机条目。

Listen 443

<VirtualHost *:443>
  ServerName www.foo.com
  DocumentRoot /var/www/www.foo.com/htdocs

  CustomLog /var/log/apache/www.foo.com-access.log combined
  ErrorLog /var/log/apache/www.foo.com-error.log

  # Example SSL configuration
  SSLEngine on
  SSLProtocol all -SSLv2
  SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5
  SSLCertificateFile "/var/www/www.foo.com/ssl/server.crt"
  SSLCertificateKeyFile "/var/www/www.foo.com/ssl/server.key"
</VirtualHost>
资料来源:http://wiki.apache.org/httpd/ExampleVhosts

SO网友:user3131603

Here is the .htaccess code

# Use PHP 5.4
AddType application/x-httpd-php54 .php 

# BEGIN s2Member GZIP exclusions

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} (^|\\?|&)s2member_file_download\\=.+ [OR]
RewriteCond %{QUERY_STRING} (^|\\?|&)no-gzip\\=1
RewriteRule .* - [E=no-gzip:1]
</IfModule>

# END s2Member GZIP exclusions

# BEGIN SSL
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ [https://]%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L]
# END SSL

# BEGIN WordPress
RewriteEngine on
RewriteBase /
RewriteRule ^index\\.php$ - [L]

# uploaded files
RewriteRule ^siteslogin$ https://example.com/wp-login.php [NC,L]
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]

<FilesMatch "\\.pdf$">
header set x-robots-tag: noindex
</FilesMatch>
# END WordPress

**And here is the wpconfig code**
# Use PHP 5.4
AddType application/x-httpd-php54 .php 

# BEGIN s2Member GZIP exclusions
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} (^|\\?|&)s2member_file_download\\=.+ [OR]
RewriteCond %{QUERY_STRING} (^|\\?|&)no-gzip\\=1
RewriteRule .* - [E=no-gzip:1]
</IfModule>
# END s2Member GZIP exclusions

# BEGIN SSL
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ [https:]//%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L]
# END SSL

# BEGIN WordPress
RewriteEngine on
RewriteBase /
RewriteRule ^index\\.php$ - [L]

# uploaded files
RewriteRule ^siteslogin$ https://example.com/wp-login.php [NC,L]
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]

<FilesMatch "\\.pdf$">
header set x-robots-tag: noindex
</FilesMatch>
# END WordPress
结束

相关推荐

Disable domain redirect

所需行为:http://www.situationware.com 应留在www.situationware.com, 无需注册。目前wordpress正在自动重定向到Amazon主机名ec2-107-22-241-162.compute-1.amazonaws.com, 如果我更新wp config,则请求用户注册。通过取消注释phpDOMAIN_CURRENT_SITE 我最终将循环重定向到http://situationware.com/wp-signup.php?new=situationware