Forums / General / where can i use redirect!

where can i use redirect!

Author Message

Christine Romel

Thursday 14 October 2004 5:38:06 am

Hi..
my site now is on a test version and not published yet.i want to use redirect so that when the main page is accessed say: www.mySite.com redirect it to www.mySite.com/test/
i want to do this instead of removing the whole site from test to the root..
how and where can i use that..
i got that javascript <meta http-equiv="refresh" content="0";url="http://www.mySite.com/test/">..

so if it is right.. which index file and where should i place that script!

i need a fast reply plzzz..

thanx for ur cooperation:)

Alex Jones

Thursday 14 October 2004 6:53:32 am

Hi, I think you would be better off using an .htaccess file for this - assuming you are using Apache. To do this, follow these steps:

1. In a text editor create a file named .htaccess (the dot is important)
2. Add this line to the file:

redirect 301 / /test/ 

3. Save the file, and upload it to the root directory on the site

The reason, I recommend this method is that it will ensure search engines know that the site has been moved, and it is transparent to the user, whereas a meta refresh can be stored in the browser's history, frustrating the user if they try to use their browser's back button. They click on the back arrow, which takes them to the page with the meta refresh, which automatically sends them back to the page they were on - an annoying loop.

One quick note, you may need to tell your operating system, and/or your HTML editors may not show you the .htaccess file once it is created, as the dot at the beginning indicates that it is supposed to be a hidden file. So, you may need to change some settings to make sure that you can see it.

<b>Additional Info:</b> See 'Strategy 2' on http://www.tamingthebeast.net/articles3/spiders-301-redirect.htm

Hope this helps. If not, let me know.

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>