Htaccess doesn't work in www and work without www

Hi, i have some problems to execute a htaccess file :(, i tried every possiblity , and nothing , so here’s the problem :

for the first time mod rewrite wasn’t installed so i sent a mail to the host to install it , and a second mail to put some directives when the htaccess didn’t work for the second time and checked on the net and i found the cause , so i told them to change the Allowoverride to All and put Options FollowSymLinks , so i tested on mydomaine.com and the .htaccess worked but only for mydomaine.com and didn’t work for www.mydomaine.com , i looked for the problem , and i found that the host made a redirection because mydomaine.com didn’t work , and after that we can access from both url but there no htaccess file , i created a new one , the problem still the same , i looked on the web , tried different guesses and nothing , the htaccess file work only for non-www and i get an 500 Internal Server Error with the www, i’m really blocked , thanks :).

Test code of htaccess
RewriteEngine on
RewriteBase /
RewriteRule ^test$ testpage.php

Hi AAymen. Welcome to SitePoint. :slight_smile:

I’m surprised the hosts can’t answer this question. Have you asked them about it?

AA,

My recommendation for cases like yours is to go find a good host (i.e., not waste time with a host like this). In fact, my last couple of moves from one host to another have had me asking about mod_rewrite (and .htaccess) as a requirement.

Regards,

DK

Hi, thanks for your replies ,yes as you said , the problem was indeed from the host , they changed the site’s configuration , and my htaccess file worked , i don’t know exactly where was the problem (cause i don’t have direct access with the host at the work), but the problem could be one of the this two , the httpd.conf file (with adding a specific allowoveride to the www domain) or disabling any restriction they added in the htaccess file for the www.mydomaine.com , thank you .