• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Best way to redirect entire site into directory

Status
Not open for further replies.

Kayz

Chevereto Member
🎯Description of the issue

So i have decided to move my entire image hosting site into a sub directory /upload/ very soon. I have a lot of url's, i think up to 2 million i believe according to the images. Without crashing my site what is the safest way to redirect all these urls into the directory safely without breaking the site and ruining my SEO? I've seen a lot of methods online but i want to ask the community here what you think would work best?

So if anybody was to visit an old url i.e. images, albums, user profiles:

www.mydomain.com/images
www.mydomain.com/album
www.mydomain.com/{username}

They should automatically reach the page with the url change:

www.mydomain.com/upload/images
www.mydomain.com/upload/album
www.mydomain.com/upload/{username}

and still be able to reach the correct page and view it without any issues.

I then intend to put a WordPress site in the root directory.

Your advice and counsel would be much appreciated.
 
This is very trivial stuff, don't be that afraid of it.

The way that you deal with this thing is using server side redirects. For Apache this is handled by mod_rewrite, using .htaccess rules and for nginx this thing is handled in the server block.

You can either redirect (the old url changes to the newer url) or rewrite (the old url and new url still works). It will depend on your needs and if this is for SEO then you want a 301 redirect (permanent).

https://stackoverflow.com/questions/42192884/redirect-entire-site-to-a-sub-folder

https://stackoverflow.com/questions/17738088/rewrite-root-address-to-a-subdirectory-in-nginx
 
This is very trivial stuff, don't be that afraid of it.

The way that you deal with this thing is using server side redirects. For Apache this is handled by mod_rewrite, using .htaccess rules and for nginx this thing is handled in the server block.

You can either redirect (the old url changes to the newer url) or rewrite (the old url and new url still works). It will depend on your needs and if this is for SEO then you want a 301 redirect (permanent).

https://stackoverflow.com/questions/42192884/redirect-entire-site-to-a-sub-folder

https://stackoverflow.com/questions/17738088/rewrite-root-address-to-a-subdirectory-in-nginx

Thank you Rodolfo,

Yes I too am looking to 301 redirect and at the same time inform Google via my webmasters portal now know as Google Console.

However I've seen too many 301 methods via htaccess and am spoilt for choice. What would happen if i did it via both htaccess and nginx?

And finally do I need to inform CloudFlare? I don't think I need to?
 
So i have used the following method in .htaccess during my tests:

RewriteRule ^imagesb1/([^/]+)$ /imagesc2/$1 [R=301,NC,L]

This redirect works for all images hosted as www.mydomain.co.uk/imagesb1/test.jpg it redirects and shows that the image has moved to www.mydomain.co.uk/imagesc2/test.jpg

However this is just 1 sub directory redirect.

I need a fix for several different sub directory redirects as images are stored in Chevereto with year, months and days..

i.e. redirect images hosted on www.mydomain.co.uk/imagesb1/2018/11/27/test.jpg to www.mydomain.co.uk/imagesc2/2018/11/27/test.jpg

The only change is the first sub directory... how do i instruct it to go into other different sub directories automatically to find the images?
 
Status
Not open for further replies.
Back
Top