Iftikhar uddin
Iftikhar uddin

Reputation: 3182

How to redirect multiple URLs dynamically with htaccess?

How can I redirect each link/URL like https://example.com/blogspot/good-url to https://example.com/blog/good-url

In all links I just want to replace blogspot with blog Is this something we can achieve through .htaccess?

RedirectMatch 302 ^/blogspot/$  https://example.com/blog/$

also tried the below but doesn't seems to work:

RewriteRule ^/?blogspot/(.*)$ https://example.com/blog/$1 [R=301,L]

Upvotes: 1

Views: 31

Answers (1)

Amit Verma
Amit Verma

Reputation: 41209

You can a simple Redirect for this

Redirect 302 /blogspot/ https://example.com/blog/

This will redirect all URLs from /blogspot/foobar to /blog/foobar .

Upvotes: 1

Related Questions