301 Redirect htaccess Change URL Structure - wordpress

I'd like to redirect all pages from a Wordpress multi-site installation to another Wordpress installation - e.g. website.com/blog/blog/page to website.com/our-blog/page
Using redirect 301 / http://www.website.com/our-blog/ doesn't work because the visitors are redirected to website.com/our-blog/blog/blog/page. Does anyone know how to remove the /blog/blog?
Thank you!

You can use RedirectMatch:
RedirectMatch 301 ^/blog/blog/(.+)$ http://www.website.com/our-blog/$1

Related

Redirect second language frontpage /da/ to first language frontpage (Wordpress)

In my Wordpress site I try to redirect the second language frontpage /da/ to first language frontpage BUT NOT the whole subdirectory.
In .htaccess I tried this code:
RewriteEngine On
Redirect 301 /da/ https://becopenhagen.dk/
which redirects the whole language (subdirectory), and this
RewriteEngine On
Redirect 301 /da/index.php https://becopenhagen.dk/
which don't redirect anything.
Would this not be possible without plugins or advanced php? Thanks!
Use RedirectMatch like this :
RedirectMatch 301 /da/$ https://becopenhagen.dk/

Wordpress change permalinks and redirect new urls 301

I was using this WordPress permalink string.
/%postname%-%post_id%.html
but now I want to change it to, and redirect all old url's to new url's
/%postname%.html
Sample old url is;
http://www.example.com/dead-trigger-2-hile-mod-apk-indir-1890.html
The new url will be;
http://www.example.com/dead-trigger-2-hile-mod-apk-indir.html
My htaccess file currently using default wordpress vars. How can redirect all my urls to new urls 301.
I tryed to use this, but its not working
RedirectMatch 301 ^/(.*)-([0-9]{4})$ http://www.example.com/$1
Try the following
RedirectMatch 301 ^/([^/]+)-(\d+)/$ http://example.com/$1
By following code you will be able to achieve 301 redirect via .Htaccess :
Syntax :
Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html
Example :
# BEGIN 301 Redirects
Redirect 301 /dead-trigger-2-hile-mod-apk-indir-1890.html http://www.example.com/dead-trigger-2-hile-mod-apk-indir.html
# END 301 Redirects

301 redirects from a flash site (.swf) to wordpress site

I am trying to get 301 redirect to work from an old flash site to new wordpress site.
If I place
Redirect 301 / http://newsite.com
it redirects everything; however new urls are different than old ones.
So I would get a lot of 404's.
For instance:
Redirect 301 /oldlink.swf http://newsite.com/old-link
doesn't work.
Try RedirectMatch directive with regex to pass old path to a new :
RedirectMatch 301 /([^.]+).swf$ http://newsite.com/newurl
This will redirect old http://oldsite.com/foo.swf to http://newsite.com/newurl

htaccess 301 Redirect Cpanel to Wordpress

I have a site at mysite.com with blog entries in the form of:
mysite.com/year/month/title.html
I want to redirect all these blogs to
wordpress_site.com/year/month/title/
I have added this to my .htaccess file in my public_html folder through Cpanel:
## 301 Redirect Entire Directory
RedirectMatch 301 mysite.com(.*) wordpress_site.com/$1
But the redirect does not seem to be working - what am I missing here?
Thanks!
The hostname isn't part of what gets matched by the regex, try:
RedirectMatch 301 ^/([0-9]+)/([0-9]+)/(.*)\.html$ http://wordpress_site.com/$1/$2/$3/

redirect only home page to a separate page wordpress multisite

In my WordPress multisite, I need need my subsite home page to redirect to a different page. Like site.com/subsite or site.com/subsite/ should redirect to site.com/subsite/home/ .
Redirect 301 can do this but, it will also redirect site.com/subsite/search?q=param1 to site.com/subsite/home/search?q=param1 . But it should not.
wp_redirect will do same.
Thanks
You want to use RedirectMatch instead:
RedirectMatch 301 ^/subsite/?$ /subsite/home/

Resources