![]() |
| Permanent redirection for .cfm to root |
|
Tunç
|
Hi,
How can we do a permanent redirection (301) http://www.example.com/index.cfm to http://www.example.com ? We are on a Windows 2003 VPS. Thanks |
||||||||||||
|
|
|||||||||||||
|
Jason101
Forum Regular
|
Sure Can.
<cflocation url="http://www.example.com" statuscode="301"> |
||||||||||||
|
|
|||||||||||||
|
Tunç
|
Thanks Jason. Do I put this on the index.cfm file? |
||||||||||||||
|
|
|||||||||||||||
|
Jason101
Forum Regular
|
Yes, but the only problem is, you will get stuck in an infinite loop since http://www.example.com/ and http://www.example.com/index.cfm are exactly the same.
If you don't specify a file name (and just hit the root), the default document is used (which is usually index.cfm) |
||||||||||||
|
|
|||||||||||||
|
Tunç
|
The reason i wanted do do it for SEO purposes. have a look at http://www.ragepank.com/redirect-check/ for example.com. Potential problems on this site * 4 pages returned a 200 response. This indicates potential for duplicate content problems. Ideally, only http://example.com OR http://www.example.com should return a 200 response. I have managed to forward non WWW to www using IIS but forwarding index.cfm to root is the problem. I think i need to invest to Helicon's ISAPI rewriter as it did work on the trial program. |
||||||||||||||
|
|
|||||||||||||||
|
nathacof
Forum Admin
|
With PHP, I'd use the REQUEST_URI variable to determine what page your visitors are using, and if it finds the string index.cfm file, redirect the url without index.cfm ...
http://example.com/index.cfm -> http://example.com/ http://example.com/directory/index.cfm -> http://example.com/directory/ I'm not a coldfusion developer but couldn't this be accomplished in your Application.cfm with a CFIF, and CFHeader? CGI Environment Variables CFHeader Just realized you IIS users don't have this environment variable. Perhaps PATH_INFO has the necessary information? |
||||||||||||
|
|
|||||||||||||
|
jamie
HostMySite Sales Rep
![]()
|
A comment on the same page that Nate referenced says
So those are what you'd need. |
|||||||||||||
|
|
||||||||||||||
| Permanent redirection for .cfm to root |
|
||
|



