Pergunta

I was wonder if it's possible to do the following: So, when you get a new hosting, you start with only a few folders right? .. and then you add a few more folders, css, js, imgs, assets, media... and so on, after one year you have about 20 extra folders, your girlfriend special card, your cousin school project, your dad's portfolio, a few "clients" that your mom sent you to help them with a charity page, and so on, so after a few years you have about 100 folders! that is crazy!the 80% of all of this folders are active, you have many Facebook fanpage with your fancy iframe... and so on..

So to the question, how can I send all of the request to this folders to a different folder, so this is what I have:

domain.com
     |_css
     |_js
     |_folder1
     |_fancy1
     |_mydadprofile
     |_mysisterpictures
     |_imgs

you get the picture...

what I would like to do is the following

domain.com
     |_css
     |_js
     |_oldstuff
     |    |_folder1
     |    |_mydadportfolio
     |    |_fancy1
     |    |_mysisterpictures
     |_imgs

if a user request for my dad's portfolio it gets a redirection to the new folder if you go to a Facebook fanpage and see the iFrame page you still able to see the information...

I was thinking to use .htaccess the same way as an error get redirected, 404 errors, 403, 301... I just don't know how to implemented...

I really appreciate any help with this, Thank you all

Foi útil?

Solução

You can just rewrite the requests with a RewriteRule

RewriteRule ^mydadprofile.*$ /oldstuff/$0 [L]

For multiple rewrites, you can add further rules.

If you want to combine them into one long rule, you can also use

RewriteRule ^(?:mydadprofile|mysisterpictures|folder1|fancy1).*$ /oldstuff/$0 [L]
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top