Forum Moderators: phranque

Message Too Old, No Replies

.htaccess help, how do I know the server access it?

         

ctwidodo

6:47 pm on Mar 28, 2007 (gmt 0)

10+ Year Member



I have the .htaccess in the main folder, I'm not sure if the server actually accesses it or not.
I have this in my .htaccess file, just to test it if it redirects non www to www domain.
Oh, and I checked with phpinfo(), and the server does mod_rewrite module on

Options +FollowSymLinks
RewriteEngine on

# Redirect if example.com (case-insensitive) to www.example.com
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

But it doesn't redirect example.com to www.example.com

jdMorgan

3:31 pm on Mar 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The code looks fine. If it is not working, then most likely it's either not being executed or the page you're requesting has been cached by your browser, and so a request is not being sent to your server (flush your cache).

Jim

ctwidodo

7:37 pm on Mar 29, 2007 (gmt 0)

10+ Year Member



I tried clearing the cache, it's still not working.
I'm sending an email to my hosting company see if they can help.
Thanks for the help Jim

ctwidodo

1:25 am on Mar 30, 2007 (gmt 0)

10+ Year Member



Okay, so I know that the .htaccess file is being accessed because I'm now getting error 500.
When I put comments on RewriteCond and RewriteRule, I'm not getting error 500.
I tried searching error 500, but it says it just couldn't determine the kind of error it encountered.
I'm not sure if I can actually get the error logs for it.
My host is 1and1 if that helps a bit.

jdMorgan

2:16 am on Mar 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Again, the code above was fine... Something is probably wrong with the server configuration.

> I'm not sure if I can actually get the error logs for it.

You definitely do need to access the server error log -- Debugging an odd problem like this will be difficult without it.

Jim