Mac OS X doesn't allow to name files starting with a dot. How do I name the .htaccess file?

后端 未结 8 1444
清歌不尽
清歌不尽 2021-01-30 03:44

As mentioned in the title, Mac OS X doesn\'t allow me to name files starting with a dot ( . ). But, I need an .htaccess file. Or, better, how do I use an htaccess file in Mac OS

相关标签:
8条回答
  • 2021-01-30 04:37

    You need to be able to see invisible files first.

    In finder press ++. –command + shift + dot– to toggle hidden files visibility.

    Then just go to the folder where the file is and you'll see it there. You can now rename the file to start with a . if you want.

    To create a new file you can do this in the terminal: touch .htaccess, once the terminal is at the right folder

    0 讨论(0)
  • 2021-01-30 04:38

    You can add an alias in your startup script file to make the command shorter. Usually this is .bashrc, .bash_login or .profile file in your home directory.

    alias ondot='defaults write com.apple.finder AppleShowAllFiles -bool YES; killall Finder'
    alias ofdot='defaults write com.apple.finder AppleShowAllFiles -bool NO; killall Finder'
    

    Now you can just type ondot to show hidden files. and ofdot for hiding hidden files

    0 讨论(0)
提交回复
热议问题