dogbreath1 21:14 16 Feb 11

I have a website and am reserving the root directory for something at a future date. I have a subdirectory in the root named 'data'. What can I do meanwhile to automatically redirect people from root to 'data'

  adam32 01:33 17 Feb 11

In your root .htaccess:

redirect 307 index.html click here

At the top of .htaccess, if not already present:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

That first line sets a temporary redirect from any request for the root index file (suffix is not important in this instance) to the data sub-directory. The second code allows htaccess mods to work.

Search for or for good guides. Change the number to 301 if you want to indicate a permanent redirect.

Caveat: htaccess tricks almost always work fine with almost every Apache server. But if doesn't, ask your host.

  dogbreath1 10:31 17 Feb 11

Doesn't work, but thanks for the response.

I've asked my host for advice on how to do this. Will post back with the answer.

  dogbreath1 13:41 17 Feb 11

I can redirect using cPanel. Better than messing about with code.

  adam32 14:59 17 Feb 11

Technically, the function that I provided does work. I'm sure that you didn't mean it as a blanket statement, but I just wanted to clarify that for the benefit of anyone else who it may help. If it doesn't work for you as implemented, that's understandable though, hence my caveat.

Regarding control panel changes, I'd always rather work directly with .htaccess/php.ini because it gives way more control and abilities to secure your website. It was actually the security issue that forced me to learn how to use .htaccess for my site.

This thread is now locked and can not be replied to.

Nintendo Switch review: Hands-on with the intuitive modular console and its disappointing games…

1995-2015: How technology has changed the world in 20 years

Prehistoric Britain is laid out in these Royal Mail stamp illustrations

Best running headphones | Best sport & fitness headphones: 4 brilliant pairs of wireless…