Bree
Bree

Reputation: 13

Redirect 301 files from subcategory to root

I moved my prestashop from subcategory(/shop) to root and now,

to fix the 404 Not Found Errors, I have to redirect all pages

from

"example.com/shop"

to

"example.com"

(for example from "example.com/shop/skirt" to "example.com/skirt"). What do I have to add to .htaccess? thank you so much.

Upvotes: 1

Views: 61

Answers (2)

idnovate
idnovate

Reputation: 1032

If you want to redirect

"example.com/shop/product-A"

to

"example.com/product-A" 

try with

RewriteEngine On
RewriteRule ^shop/(.*)$ /$1 [L]

If you want to redirect the browser so that the new URL appears in the location bar, add an R flag in square brackets:

RewriteEngine On
RewriteRule ^shop/(.*)$ /$1 [L,R=301]

Upvotes: 1

Amit Verma
Amit Verma

Reputation: 41249

You can use the following Redirect in your htaccess :

Redirect 301 /shop/ http://example.com/

This will 301 redirect your subfolder to the root including all pages and directories from /shop to / .

Upvotes: 0

Related Questions