How to write a .htaccess file correctly

Hm, something went bezerk in the text on the web.
Should be:

<?
header( "Location: http : // w w w .mysite.com / index . php ", True, 301 );
?>

Sorry about that.


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You have the entire recipe there. I would change the first line from 404.htm to 404.php, but that’s about it. The ErrorDocument part just goes by itself on a single line in the .htaccess file, and the PHP part is just as it is here, but don’t put the backslashes in before the quotes, they negate the quotes and your code won’t run.

Walter


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thank you Walter

Here’s som additional information I got recently, maybe it explains the back-slashes? ?
My own ISP wrote me that in his .htaccess is this code

php_flag session.use_trans_sid off
php_flag register_globals off
<Files ".ht*">
deny from all
</Files>

and in the server config is this:

<code>ErrorDocument 404 /404.htm</code>

Final question:
Do you mean that I should rename also the filename 404.htm to 404.php?

And should I write in the .htaccess file on this other server only this (and rename the 404.htm to 404.php)

ErrorDocument 404 /404.php 

and put in the error.php this:

<? header( "Location: http://www.mysite.com/index.php", True, 301 ); ?>

I’m completely a noob when it comes to .htaccess.

Thanks!


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I don’t understand why your admin used backslashes in an .htaccess
file, it doesn’t have to be there unless you are trying to actually
act on a filename with a quotation mark in it.

Also, you don’t need the thing in these list messages – adding
the four tildes on either side of the code is the same as writing

 your code here 
. For one or two word examples

inline, you can wrap a word or phrase with back-ticks foo() and get
foo() back on the Web.

Walter

On Nov 25, 2009, at 11:04 AM, atelier wrote:

Thank you Walter

Here’s som additional information I got recently, maybe it explains
the back-slashes? ?
My own ISP wrote me that in his .htaccess is this code

php_flag session.use_trans_sid off
php_flag register_globals off
<Files ".ht*">
deny from all
</Files>

and in the server config is this:

<code>ErrorDocument 404 /404.htm</code>

Final question:
Do you mean that I should rename also the filename 404.htm to 404.php?

And should I write in the .htaccess file on this other server only
this (and rename the 404.htm to 404.php)

ErrorDocument 404 /404.php

and put in the error.php this:

<? header( "Location: http://www.mysite.com/index.php", True,  
301 ); ?>

I’m completely a noob when it comes to .htaccess.

Thanks!


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

sorry about the thingy Walter, sometimes I just forget. It’s the weather, probably. Or age… :wink:

And it’s a yes to my previous post?


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On Nov 25, 2009, at 11:04 AM, atelier wrote:

Thank you Walter

Here’s som additional information I got recently, maybe it explains
the back-slashes? ?
My own ISP wrote me that in his .htaccess is this code

php_flag session.use_trans_sid off
php_flag register_globals off
<Files ".ht*">
deny from all
</Files>

and in the server config is this:

<code>ErrorDocument 404 /404.htm</code>

Final question:
Do you mean that I should rename also the filename 404.htm to 404.php?

And should I write in the .htaccess file on this other server only
this (and rename the 404.htm to 404.php)

ErrorDocument 404 /404.php

I am not sure if you can set this in the .htaccess – by the time that
file is read, it may be too late. Try it, but be prepared to put it at
the httpd.conf level if it doesn’t work. Yes to the rename question.

and put in the error.php this:

<? header( "Location: http://www.mysite.com/index.php", True,  
301 ); ?>

Yes, this is correct.

I’m completely a noob when it comes to .htaccess.

Everyone begins somewhere.

Have a great Thanksgiving,

Walter


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Happy Thanksgiving to you too, Walter!
How I wish I could do something for you in return for all the good advise you have been giving all those numerous times. Really.

The methode worked, as one can check here:

http://www.instantposition.com/http-header-tool.cfm

just call http://www.minnessten.se/anything.html

Thanks again.

Hans


offtopic mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options