Redirect

  dogbreath1 21:14 16 Feb 11
Locked

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 corz.org or askapache.com 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.

Surface Pro 5 News - release date, UK price, features, specs

Microsoft Surface Studio hands-on review: the iMac killer is here

Best Mac antivirus 2017