Jump to content

Create .htaccess after moving to subdir


Recommended Posts

So I have moved my prestashop site from the root to the subfolder /shop.

The root is going to be used as a new, more static site.

 

Now i want to 301 redirect all the old links to the new /shop folder. Is this possible to do it with some rules.

I have tried some redirect generators, but they all end up with a separate line for each category / product. (4500+ lines)

 

The sitemap was the guideline to find all my links.

 

Anyone some ideas?

 

Link to comment
Share on other sites

I would do something like this:

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} !^/blog/

# Rewrites all URLS [Replace "domain" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.

# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /blog/$1 [L]

the idea is posted here:

http://wiki.dreamhost.com/Transparently_redirect_your_root_directory_to_a_subdirectory

 

for rewrites, you are better searching without the keyword PrestsaShop to get better results.

 

I'd also try this one

http://www.jamescoyle.net/how-to/1424-apache-redirect-root-url-to-subfolder

Link to comment
Share on other sites

I would do something like this:

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} !^/blog/

# Rewrites all URLS [Replace "domain" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.

# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /blog/$1 [L]

the idea is posted here:

http://wiki.dreamhost.com/Transparently_redirect_your_root_directory_to_a_subdirectory

 

for rewrites, you are better searching without the keyword PrestsaShop to get better results.

 

I'd also try this one

http://www.jamescoyle.net/how-to/1424-apache-redirect-root-url-to-subfolder

 

These examples works fine as you don't wish to use the root directory. (And i do  :) )

When i create a index.html file into the root, and type www.mysite/index.html the examples above gives also the unwanted redirect to /shop.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...