PDA

View Full Version : .HTACCESS question


JoeH
03-23-2017, 10:59 AM
Hi, Hope this is the right forum - I'm trying to generate a simple .htacces file for a website. At the moment there are only 3 commands and this is the order they appear in the file:

# KEEP ALIVE #
# OPTIMIZE WEBSITE #
# 404 #

When i add the fourth - #EXPIRE CACHING # between the Optmize and the 404 the 404 fails. Does it matter which order the instructions appear? I can post the code - if this is the right forum. Many thanks Joe.

edbr
03-23-2017, 11:55 AM
no order should not cause it. post the code and ill look tomorrow

JoeH
03-23-2017, 11:59 AM
Hi Edbr, that would be great - here's the code:-

## KEEP ALIVE ##
<ifModule mod_headers.c>
Header set Connection keep-alive
</ifModule>
## KEEP ALIVE ##

## OPTIMIZE WEBSITE ##
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
## OPTIMIZE WEBSITE ##

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType text/html "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwaveflash "access plus 1 year"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 1 month"
</IfModule>
## EXPIRES CACHING ##

## 404 ##
ErrorDocument 404 /404.html
## 404 ##

Many thanks. Joe.

edbr
03-27-2017, 07:27 AM
sorry been off sick so on my phonebut i xant see an error

Bill Goldberg
03-27-2017, 08:32 AM
I thought this could be solved easily but now only am getting know that there are this much issues involved in this task.

JoeH
03-27-2017, 10:21 AM
Hi, Many thanks for your time. I've changed the order of the commands - just to see if it made a difference and i gat an Internal Server Error and the page would not load. So i think the problem is server side. I'll contact the guys that 'support' the hosting etc. Many thanks for your time. Joe.

Bill Goldberg
04-19-2017, 08:24 AM
Thank you very much for the most useful tips.

Bill Goldberg
04-22-2017, 05:35 AM
Can we add robots.txt file in htaccess file?

edbr
04-22-2017, 08:59 AM
no point robot tet files are actively searchrd for