Hi All, my site is hosted on apache server. I was trying to redirect (301) the non www version of my website to www. The code i was using in my .htaccess file was: RewriteEngine On rewritecond %{http_host} ^domain.com rewriterule ^(.*)$ [domain.com...] [r=301,L] I have tried the same code earlier on my other websites and it had worked bt now its not working. When I upload htaccess file with above code, i get an 500 Internal Server Error.Can you people suggest any thing. One more thing that i have found that there are around 5-6 .htaccess file in various folders like vti_log, vti_cnf and others with code: # -FrontPage- IndexIgnore .htaccess */.?* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit> AuthName domain.com AuthUserFile /home/folder/public_html/_vti_pvt/service.pwd AuthGroupFile /home/folder/public_html/_vti_pvt/service.grp Does this code have anything to do with my problem and what the above code mean. Please help.
Ok I figure out the code partially that is authentication code + setting code for view & change the files. Now 2 questions: 1. Could anybody tell me why my redirecting code is not working with this code. (when i upload the above redirection code with these lines of code, I got an internal 500 server error) 2. Are these lines of code correct: <Limit GET POST> order deny,allow deny from all allow from all </Limit> Please help.........
Move the existing .htaccess out of the way and then put the following in an empty .htaccess, obviously changing the domain name to yours: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.tolranet\.co\.uk [NC] RewriteRule (.*) http://www.tolranet.co.uk/$1 [R=301,L] Code (markup): If you still get the 500 error then log a ticket with your host asking them if mod_rewrite is enabled if not can it be, your host should be in the best position to debug this for you. Assuming the above works then add in the <Limit and other items you need from your stored .htaccess, just add one thing at a time if it stops working you know the last thing you added was the cause of the issue and we can go from there.
can u please tell me why have u used www in this line: RewriteCond %{HTTP_HOST} !^www\.tolranet\.co\.uk [NC] as i am writing for a condition that if somebody tells the url without non www then redirect it to www
It says if it is NOT www.tolranet.co.uk then rewrite it. This is the version I give to our clients as that way when they park another domain on top or some such the rewrite rule just works without them having to add the new domain.
Oh yes, i just forgot the wild character meaning. Thanks the redirection code is working fine now. Now i have to check for other code. Thanks once again.
If you find it issues a 500 again, just post up your whole .htaccess along with which bit you added to cause the failure and I'll see what I can do.
No its working fine now. I have uploaded with all the code. have placed the redirection code on top then other lines of code.