.htaccess file at godaddy
Nov 23, 2009 Php
Godaddy a big name in the world of internet and web hosting. There are thousand of websites hosted on godaddy.com. Lot of programmers have faced godaddy, may be they are experienced or fresher. In today’s programming world htaccess is a comman name but its always an advanced topic specially for beginners. As search engine markting is growing everyday , the use of htaccess is also growing . But there is difference between godaddy’s htaccess and other htaccess , not very much but that is important to know for everybody.If you are not familiar with the rules of godaddy’s htaccess then it will make headache for you.
when i first time worked on Godaddy i put my head on the table , oh god my htaccess was not working on that server .On that day the demo was scheduled for my site and that damn htaccess killed my all happiness.Here I will not talk very much about htaccess rules but common problems with Godaddy’s htaccess.
1.In lot of accounts at godaddy there are stil php4 working .This may be because of user don’t know about php4 or php5.Its not necessary that the person which is buying space on server must be a technical person.Our Lot of clients don’t know about php4 or php5 , they only know that their site has been made in php.But now a days php5 is very much in use and when you will upload a site made in php5 on server which has php4 then it may generate errors . If you faces this prob then just put these 2 lines at the top of your htaccess file and you will see the magic.
AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4
These both lines can also be used to manage PHP file extensions.I tell you:
By default, files with a .php extension run under PHP 4 and files with the .php5 extension run under PHP 5. The .htaccess file, located at the root of your site, can be used to change these default settings. The following entries in a directory’s .htaccess file designate .php files to run under PHP 5 and .php4 files to run under PHP 4.
2.Most important thing that always upload htaccess at godaddy using ASCII mode and change permission to 644.
3.Make sure you create an .htaccess file using a plain text editor that doesn’t use word wrap.
4.One problem i faced on godaddy when i used this line “RewriteRule ^((.*/cdirections|cdirections)/([a-zA-Z0-9-_]+)/([a-zA-Z0-9-_]+)?)$ community_directions.php?id=$3&name=$4″. This line works very well at other servers but not at godaddy.This line rewrite the url like this www.yoursite.com/cdirections/rewrite-url.
You can see a rule in this line ‘a-zA-Z0-9-_‘ , It means you can use chars from a-z , A-Z and 0-9 and – and _ in the url. After taking lot of time i found that when used on godaddy this rule was making another meaning . That was making an another range of words “9-_” but actually this is not a range so it was making problem.finally i changed this and made this line and now its working fine.
“RewriteRule ^((.*/cdirections|cdirections)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)?)$ community_directions.php?id=$3&name=$4”
You can see the change in both lines.
so this is the summary of my exp. with godaddy’s htaccess.Just use these rules and feel happy.
Tags: .htaccess, 644, Apache, ASCII mode, extension, godaddy, godaddy server, mod_rewrite, permission, php4, php5, rewrite rule, rewrite rules, search engine markting, search engine optimization, server
Leave a Reply