RedirectMatch / blog /?(某事)到/?(某事)

时间:2012-01-02 10:42:14

标签: wordpress .htaccess redirect

我正在尝试重定向所有包含“/ blog /?”的请求到“/?...”并在我的.htaccess中使用以下内容:

RedirectMatch 302 /blog/?(.*) http://www.example.com/?$1

但是当我检查时,

/blog/?p=28  -> www.example.com/?

所以剩下的就被截断了。

p / s /我不想将/ blog /(某事)重定向到example.com/(something)!

p / p / s /我安装了wordpress,如果这可能很重要的话。我需要做那种事情因为我将我的wordpress文件夹改为root并使用/ blog /来显示最近的帖子

2 个答案:

答案 0 :(得分:0)

尝试此代码.htacess

Options +FollowSymLinks

RewriteEngine On

#RewriteBase /





RewriteRule ^ProductView-(.*).html product.php?page=$1



RewriteRule ^Home.html index.php

将您的文件名设为这样并更改enter code here

答案 1 :(得分:0)

在.htaccess中使用此代码来实现:

Options +FollowSymLinks -MultiViews
RewriteEngine on

RewriteCond %{QUERY_STRING} !^$
RewriteRule ^blog/?$ / [R=301,L,QSA]