Breaking line in .htaccess

Posted on 2007-03-29
Last Modified: 2008-03-06

how can I break the link with this code? I tried to include \n but it doesn't work. The code will write to .htaccess file.

$ip = "deny from $REMOTE_ADDR\n" ;
$banip = '.htaccess';
$fp = fopen($banip, "a");
$write = fputs($fp, $ip);

.htaccess file output, it cannot break the line in between "deny from"

<Files 403.shtml>
order allow,deny
allow from all
deny from from 456.122.8.10deny from 696.122.8.10

thank you
Question by:simoa
  • 2
LVL 48

Expert Comment

ID: 18816287
$ip = "\ndeny from $REMOTE_ADDR";
in this case
LVL 29

Accepted Solution

TeRReF earned 50 total points
ID: 18816352
If that doesn't work, try:
$ip = "\r\ndeny from $REMOTE_ADDR";

Author Comment

ID: 18816467
hernst42: sorry your couldn't work thanks for helping.

TeRReF: thanks it works.
LVL 29

Expert Comment

ID: 18817173
You're welcome.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now