Create .htaccess File


#1

Hi,

I am using Windows XP and I want to create a .htaccess file to be uploaded to dreamhost server. I have tried to create one using windows notepad under ANSI encoding. However, after upload it to the server using FireFTP, the site shows “Internal Server Error”. I guess the problem is due to the requirement of unix-style line endings sytle.

How can I create .htaccess file with unix-style line endings in Windows system? Thanks.


#2

Use the DreamHost panel’s WebFTP link under Domains -> Manage Domains.
From there, you can FTP to your site and use the New File button to create your .htaccess file.

It also looks like FireFTP has a similar feature - at least one that lets you edit remote files. Maybe it will let you create a remote file as well.


#3

Thanks a lot for your reply. But it seems to be doesn’t help at all. The file saved seems like not unix-style line endings.


#4

are you trying to actually view the .htaccess file like going to mysite.com/.htaccess? because you can’t. putting a period in front of the file makes it hidden. its like its not there. those types of files are to be utilized internally by the server and you would not be able to browse to it like that.

also if you are getting internal server errors it is more likely that whatever you have in your .htaccess file is incorrect. you might want to tell us what you’re doing so we can help you out.


#5

Thanks for your reply. I am actually trying to use .htaccess file to have gzip compression on my website on css, js, php, and html files. Here is the code that I try put into htaccess file:

[code]# BEGIN GZIP

OLD GZIP CODE

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript

NEW GZIP CODE

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript # Netscape 4.x has some problems... BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html # Don't compress images SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies don't deliver the wrong content Header append Vary User-Agent env=!dont-vary

END GZIP[/code]


#6

I’m hopeful that someone with more knowledge of the rules you are using will chime in because I use content management systems on my website that write up the htaccess files for me so…

Now this may do absolutely nothing when I uploaded what you had to one of my websites it threw an internal server error but when I moved part of it around i didn’t get the error. I don’t know if there was really any difference or if the rules are even actually working because the test site I used said the pages weren’t being compressed so…

<ifmodule mod_deflate.c="">  
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript  
# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
</ifmodule>
<ifmodule mod_setenvif.c="">  
# Netscape 4.x has some problems...  
BrowserMatch ^Mozilla/4 gzip-only-text/html  
# Netscape 4.06-4.08 have some more problems  
BrowserMatch ^Mozilla/4\.0[678] no-gzip  
# MSIE masquerades as Netscape, but it is fine  
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html  
</ifmodule>  
<ifmodule mod_headers.c="">  
# Make sure proxies don't deliver the wrong content  
Header append Vary User-Agent env=!dont-vary  
</ifmodule>

#7

I’m signed up for at least another year with DreamHost, but I am a moron. Nothing here makes sense. Can someone PLEASE direct me to a web hosting site for morons who don’t speak this crazy moon language?

All I want to do is block a stalker. I’ve created an .htaccess file that’s sitting prettily on my desktop. I have created, Lord help me, a WebDAV htaccess file of some sort, but see nowhere to upload any script (?) if that’s even what I’m supposed to do. Dream Host has my money, and they really should have some sort of breathalyzer-textalyzer that keeps complete noobs from signing up. As is, I have no idea if I’ve done a good or bad thing.

I can hear the eye-rolls from all the way over here. :o)


#8

Joan if you want to upload your .htaccess file you need to get a FTP program like filezilla but there is also FireFTP which is a firefox plug-in so you can do this stuff from your browser window. You can also go to manage domains and use the webftp link there.

I would like to mention though that it would be impossible to block a serious stalker unless you restrict access to your website from all but a few certain people. If you want to allow everybody access and just block a few domains/ips that is useless because any noob can use a web proxy to look like they are even visiting your site from another country. Are you using some sort of content management system like wordpress or drupal or did you just create html pages and upload them? If you have a blog or something there should be a way so that only registered users can view posts, comment etc

Also please don’t hijack other people’s threads. Create a new one unless you are working with the exact same issue as the OP, which you aren’t in this case as he is trying to compress his pages and not block people.


#9

[hr]
Thank you for the attempt. I understood half of it.

I hate having people register for my site.

Sorry for the hijack. It was inadvertent. I do know better, but had 10 tabs open in different wikis, hoping, longing for understanding.

I’ll be seeking out a different hosting company. Thanks again.


#10

I’m sending you a private message Joan