Ole*_*leg 5 wordpress .htaccess mod-rewrite url-redirection
下面的.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]
Run Code Online (Sandbox Code Playgroud)
这是redir2用于redir1屏蔽的重定向到的.htaccess 。目的是让用户输入例如的redir2/sub投放内容redir1/sub,但显示的网址redir2/sub。
在我的本地安装上运行正常。但是在我的共享主机上,它无需屏蔽即可重定向。我认为问题可能出在服务器配置中。
任何想法可能是什么问题?
只是为了记录,这里是另一个类似的问题,当我使用屏蔽重定向时索引文件出现问题时,我问了以下问题:请求根目录时,使用域屏蔽进行htaccess重定向不起作用
小智 0
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');
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
762 次 |
| 最近记录: |