[英]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.