Forum Moderators: phranque

Message Too Old, No Replies

What am I doing wrong with htaccess?

         

Rightz

4:50 pm on Jun 11, 2006 (gmt 0)

10+ Year Member



I don't know much about .htacess - I've just added code when told to do so or searched online for code for the non www to www rewrite.

I've recently added some php pages to my site. I also have SSI - which now doesn't work - I've had to change it to php includes - even on the html pages. I was quite happy using SSI.

Can someone look at my htaccess and tell me what I should have in it please?

Thanks

-----

AddType text/html .shtml .html

AddHandler server-parsed .shtml .html

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ [mysite.com...] [L,R=301]

AddHandler server-parsed .html
RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

jdMorgan

5:13 pm on Jun 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The Addtype directive sets the MIME-type reported in the server's response header sent to the client when a page is requested. You *should not* set the MIME-type of any filetypes to "application" unless you want them to be downloaded instead of being rendered by the browser. Regardless of whether an HTML page is static, contains SSI, or is generated by PHP, its MIME-type should be "text/html".

It may not be possible to mix SSI and PHP on your server, depending on how it's configured and whether you're allowed to change the configuration. That's not something I know a lot about, so i'll leave that part of the question for others. We have had some previous discussion of this in the WebmasterWorld PHP forum, and a search for those previous threads might prove helpful.

Jim

Rightz

10:46 pm on Jun 11, 2006 (gmt 0)

10+ Year Member



Thanks I will check out the other posts as well.

I will change my SSI to php includes.

Would I re-write

AddType text/html .shtml .html .php

AddHandler server-parsed .shtml .html

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ [mysite.com...] [L,R=301]

?

It suggested this makes it harder for the server. Is there any part of the code I should avoid?

Rightz

9:45 am on Jun 12, 2006 (gmt 0)

10+ Year Member



I've taken a look at other posts and although theyve helped me - I'm not sure if the above code is conflicting with each other.

Any clues? :)

jdMorgan

4:02 pm on Jun 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your code posted in msg#3 looks fine. Have you tested it? If so what were the results?

Jim

Rightz

7:21 am on Jun 13, 2006 (gmt 0)

10+ Year Member



I've tried using the code in msg 3 and without

AddType application/x-httpd-php .php .htm .html

I can't seem to get it to work. It shows the php code and doesn't show up any of my images.

What else could I use?

jdMorgan

2:53 pm on Jun 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The following threads from the WebmasterWorld PHP forum library may be helpful:

[webmasterworld.com...]
[webmasterworld.com...]
[webmasterworld.com...]

Jim