Raist said:
You're saying that we just create a file and plop it in the root, file named ".htaccess" -- oldpage.htm I'm guessing should be the index.htm ?
Yes. If you want to redirect /index.htm to
http://www.your-site.com/home.php, for example, then your rule would be:
Code:
RedirectPermanent /index.htm http://www.your-site.com/home.php
The file must be called only '.htaccess'. Windows Notepad has a tendency to silently add a .txt onto the end of the filename. So make sure that it's not there when you upload it.
The new location I understand. So a browser will automatically look for .htaccess before index.htm? I never did understand server-side instructions regarding page access.
.htaccess files are never seen by the browser, it all happens on the server-side. When a server receives a request for a resource (like index.htm or header.jpg), it checks several places for anything that might need doing to that request. This can be in the main server config, the virtualhost definition for the individual site or an .htaccess in the site directories.
So, the user-agent/browser requests a page on a server. The server finds out that the page request should be redirected to another location, and sends that response back to the user-agent. The user-agent now must (if it adheres to the HTTP specification) automatically request the page at the new location. And in the case of the 301 redirect, it must do this for all future requests. Thus the server receives the new request and can send back all the data for the page.
Be aware that .htaccess files operate recursively. So a 'rule' applied in a .htaccess file in
www.123.com/dir1/ will also be applied to any sub-directories like
www.123.com/dir1/dir2. You can override this behaviour by placing another .htaccess in the sub-directory to cancel the one higher up.
More on htaccess here:
http://httpd.apache.org/docs/1.3/howto/htaccess.html
