user5093849
user5093849

Reputation:

Url redirect using .htaccess from old url links to new url links

Url redirect using .htaccess from old url links to new url links I want to redirect the url from http://www.example.net/abc/abc-post/item/123-abc-xyz to https://www.example.net/abc/index.php/123-abc-xyz.

I tried the following code , but it is not not working in .htaccess

redirect 301 http://www.example.net/abc/abc-post/item/123-abc-xyz https://www.example.net/abc/index.php/123-abc-xyz.

Upvotes: 2

Views: 84

Answers (1)

anubhava
anubhava

Reputation: 786031

You cannot use http:// and hostname in URI pattern. Also it is better to use RedirectMatch so that you can capture 123-abc-xyz and reuse in target:

RedirectMatch 301 ^/abc/abc-post/item/(123-abc-xyz)/?$ https://www.example.net/abc/index.php/$1

Upvotes: 1

Related Questions