Forum Moderators: phranque
I have a site I remodeled some months ago. I moved the site to an Apache server.
I made all my changes to the site except for some of the file names.
The site was previously on a windows server and many pages were named .asp.
I did not want to change some of the file names because the file name changes would likely have hurt the rankings of the .asp pages.
So I did the site, left most of the .asp pages the same name and everything seemed to be worky just fine.
I put this in my .htaccess file : AddHandler server-parsed .html .htm .asp
I did not check the site with FF browser. I wish I did because it is not parsing the asp pages but rather is just showing them in text format. Instead of seeing a parsed page of the site I just see all the html source code. Nothing parsed.
After all that my question is how to edit my .htaccess file, what directives do I use and are there any directives I can use to make FF parse an .asp file on an Apache hosted server?
IE 6 seems to parse the asp pages just fine.
I wanted to change all the pages to html and do a 301 redirect on the asp pages but to 301 12 pages seemed like a lot and I obviously do not want to damage current rankings for the current .asp files.
If I put in 12 of these directives would that be bad? I did one so I know it works.
Redirect 301 /page-1.asp [site-1.com...]
Redirect 301 /page-2.asp [site-1.com...]
Redirect 301 /page-3.asp [site-1.com...]
If this is not the best way to do this any help would be appreciated.
Thank You, Joe
First, it is the server that parses .asp files (or any other files), not the browser. The server 'examines' the file for server side includes or script calls, and includes or executes them. That's parsing.
Next, the result of that is sent back to the requesting user-agent, in this case, a browser.
The browser needs to know what 'language' the data it is receiving is in, so that it can determine how to 'render' that data.
In this case, the problem is that the server is not sending a Content-Type header, or that the header it is sending is incorrect. You'll need to add:
Addtype text/html .asp
By way of explanation, the default Internet Explorer configuration is that IE will render data received from a server based on the data itself, and ignore the Content-Type header unless it cannot make up its mind based on the content alone. So in this case, that worked to your advantage in IE, but covered up the problem that caused firefox to render the page as "text/plain"
The third and final piece of this puzzle is that your redirects are self-defeating, in that they *will* cause the search engines to change the URLs. You might simply want to 'map' .asp URL requests to .html files, leaving your URLs unchanged. This can be done with Apache mod_rewrite:
Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^page-1\.asp$ /page-1.html [L]
RewriteRule ^page-2\.asp$ /page-2.html [L]
RewriteRule ^page-3\.asp$ /page-3.html [L]
RewriteRule ^(.+)\.asp$ /$1.html [L]
Finally, rewriting or redirecting 12 pages is 'not a lot' and I've seen sites with many hundreds of rewrites and redirects. The only real problem with your approach is that you used an external redirect (which informs the client to change the URL) when it isn't necessary, and may affect your search rankings. The best bet is to never, ever change a URL... ever. :)
The only time I relax that rule myself is when changing a site one last and final time to use 'extensionless' URLs -- that is, to use example.com/page1 instead of example.com/page1.html or example.com/page2.asp. Since the Content-Type header identifies the type of 'page' being requested and served, the "filetype" serves no real purpose on the Web, except to cause the kind of problem you are now dealing with. It unnecessarily identifies the 'technology' of your site, and that technology is --as you've found out-- subject to change.
See the resources cited in our forum charter and in our library for more information (links at top of this page).
Jim
I must say I am grateful for your response. While many don't take the time to teach you went above and beyond the response I expected to get. I am sure willing to listen and learn and you sure taught me a thing or two tonight.
I read your instructions and used this: Addtype text/html .asp
I did not need to go any further as the server is now parsing the data and FF is no longer rendering it as text.
Since only a few of my asp files were changed to html I went ahead and returned them to their original file name as they were only changed to html files for a very short time.
I also read your post a few times to better understand and made notes of the other options you offered in case I need to do this or something very similar again. Because as you said the site technology is subject to change.
Again, Thank You Jim, Joe