"Copy the generated code into your .htaccess file"

Hey guys,

I stumbled upon "Copy the generated code into your .htaccess file" which assumes that I a) know what that file is and b) have that file or c) after I found out what it is, am able to create it. Unfortunately I am not, everything I found on the net is very confusing, I don't know how to safely create and add a file like that to my website. Do you have a link that step by step explains me how to do that on a mac? Thanks!

  • Mike Wiesman

    Hi Sina,
    This shouldn't be too difficult for you to complete. Probably the easiest way to go about this if you have FTP access our using the File Browser in your cPanel.

    You are going to have to create an empty text document. Open TextEdit on your mac and open a new document. After it is open, click on "Format" in the stop menu, make sure that you document is in Plane Text.

    You should be able to then save and name this file to .htaccess.txt. Save it somewhere you can find it.

    Next you will upload that file into your "www" folder on your host. (www is also the same folder at public_html) Once you have it uploaded there, you should be able to right click on it and remove the ".txt" at the end of it. Thus becoming .htaccess (You may have to check a box when your launch your file browser to "show hidden files", or if using an FTP client, you might have to turn on "show hidden files"

    If you need to edit the file or, in your case copy and paste, you would open this file in TextEdit, Edit it, Save it, and upload it again to the same place.

    Hope that helps.

    PS, what kinda stuff are you adding to it (what plugin?) if you don't mind me asking?

    • Sina

      Hey Mike,

      Thanks for that extensive reply! Before trying to create and inject one myself I thought about trying to see if there is one already, Alex in the post below said most sites already have one apparently. What I want to add are two things that "Humminbird" prompts me to add to improve my site speed.

      - some text to enable gzip
      - some text to enable browser caching

      My site (http://psychologie-aufnahmetest.de/) performance in terms of speed is pretty bad, only grade C on pingdom That's why I want to get this done. Now I don't know how to find the file and add this parts to it. I don't know what cPanel is and I haven't used ftp before. I just made the site with Worpress and the Avada theme. I downloaded Filezilla (which I think is "using ftp") but for now I wasn't able to connect to my site. I don't know if I have to enable something in the wordpress settings to be able to do so. Any help to be able to add those snipets is highly appreciated

    • Sina

      Hey Alex,

      Thanks for that reply! What I want to add are two things that the plugin "Humminbird" prompts me to add to improve my site speed.

      - some text to enable gzip
      - some text to enable browser caching

      My site (http://psychologie-aufnahmetest.de/) performance in terms of speed is pretty bad, only grade C on pingdom That's why I want to get this done. Now I don't know how to find the file and add this parts to it. I don't know what cPanel is and I haven't used ftp before. I just made the site with Worpress and the Avada theme. I downloaded Filezilla (which I think is needed to "use ftp"? I'm on a mac) but for now I wasn't able to connect to my site. I don't know if I have to enable something in the wordpress settings to be able to do so. Any help to be able to add those snipets is highly appreciated

  • Sina

    Hey Alex,

    Wow dude, thanks for the fast reply ^^ I'm diving deeper into it. Following your reply and doing some research I managed to connect to my site using ftp (see screenshot) Now I actually see the .htaccess file. I'm getting a bit nervous now When I rightclick I could open the file using the default editor (textedit). Should I do that? Can I then just add the two textblocks on the bottom of the file and save it?

    UPDATE: I tried editing the file, but I can't I get an error: ..../.htaccess: open for write: permission denied

    And I can't find out how to "give myself" the permission, as it's my website/webspace etc. I should be able to, right?

  • Alex Stine

    Hello,
    Hope you are well.

    I really need to get a closer look at your site. Could you please send me your FTP details to me through our secure contact form?
    https://premium.wpmudev.org/contact/

    Select "I have a different question" from the "What would you like to talk to us about?" drop down.

    Please insure that this text is in the subject field so it is assigned to me.
    Subject: Attn: "Alex Stine"

    Please include in the message body.
    Link back to this ticket.

    FTP host, port, username, and password.

    Please update this ticket when the information is sent.

    Cheers,
    Alex