简体   繁体   中英

RedirectMatch /blog/?(something) to /?(something)

I'm trying to redirect all requests which have "/blog/?" to "/?..." and use the following in my .htaccess:

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

but when I check it,

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

so the rest is truncated.

p/s/ I don't want to redirect /blog/(something) to example.com/(something) !

p/p/s/ I have a wordpress installed, if that might matter. And I need to do that kind of stuff because I changed my wordpress folder to root and use /blog/ to show recent posts

try this code .htacess

Options +FollowSymLinks

RewriteEngine On

#RewriteBase /





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



RewriteRule ^Home.html index.php

put your file name like this and change enter code here

Use this code in your .htaccess to achieve that:

Options +FollowSymLinks -MultiViews
RewriteEngine on

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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