繁体   English   中英

htaccess重定向与域屏蔽WordPress网站无法正常工作

[英]htaccess redirect with domain masking for Wordpress site not working

以下.htaccess配置无法在Wordpress站点上运行以实现具有屏蔽的域重定向:

DirectoryIndex index.php

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www\.)?redir2$ [NC]
RewriteRule ^ http://redir1%{REQUEST_URI} [L,NE,P]

这是redir2 .htaccess,用于通过屏蔽重定向到redir1 我们的目标是让用户例如键入redir2/sub ,投放的内容redir1/sub ,但显示的URL redir2/sub

它在我的本地安装上工作正常。 但在我的共享主机上,它没有屏蔽重定向。 我认为问题可能出在服务器配置的某个地方。

任何想法可能是什么问题?

仅仅是为了记录,这是我在使用屏蔽重定向时遇到索引文件问题的另一个类似问题: htaccess重定向,域请求在请求根目录时不起作用

Wordpress规范URL功能旨在实现此目的。

虽然这个插件不再受到支持,但它可能会起作用。

<?php
/*
 Plugin Name: Disable Canonical URL Redirects
 Plugin URI: http://www.ImagineThought.com/
 Description: Disables the "Canonical URL Redirect" feature of WordPress (in versions of Wordpress 2.3 and greater). To use this plugin, simply activate it. Then, disable this if you need to re-enable the "Canonical URL Redirect" feature of WordPress.  
 Version: 1.0.11.0228
 Author: Geoffrey Griffith
 Author URI: http://www.ImagineThought.com/
 License: GPL
*/

 remove_filter('template_redirect', 'redirect_canonical');
 ?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM