.htaccess help needed!


#1

Hi fellow dh people!

I am struggling to revise my .htaccess file in the root of my website.

It seems any lines of code causes an internal server error (500)??

I have even used the simple line below, which leads to an error!?

Thanks in advance!
[hr]

Even a blank .htaccess file is causing the above error? I have no idea what is going on?


#2

It’s probably your text file editor using the wrong characters for linebreaks or inserting a BOM at the beginning.

What are you using to make and edit the file?

If you know how, try logging in via SSH and using nano instead.


#3

I’m starting to think this may be the issue… I have used MS Notepad…

Let me try again :)[hr]
It has been a while since I used putty… fark.

Is there a text editor that complies with apache requirements?[hr]
Thank you Atropos!!

I was able to remember enough commands from my university days :)[hr]
I have a side question!

How do I go about blocking access to various directories within the root from the one .htaccess file?

Cheers.


#4

If you are talking about url-paths without conditions, use the Redirect directive.

Otherwise use this module: Apache Module mod_rewrite

See also Htaccess file overview


#5

I just want to make directories “/a”, “/b” and “/c” forbidden. Is this possible?