mod_rewrite installed on server?

They have: 3 posts

Joined: Jun 2007

I'm a rookie with server-side scripting.
I cannot get simple mod_rewrite commands to work in my .htaccess file.

My web host advertises that it is available, and their tech support claims that mod_rewrite is installed on the server my sites are on.

Can anyone help? The code below does nothing, no server errors, nothing.

RewriteEngine on

RewriteCond  %{HTTP_USER_AGENT}  ^Mozilla.*
RewriteRule  ^/$                 /index.html  [L]
RewriteRule  ^/$                 /mobile/index.html  [L]
'

The details:
Apache 1.3.29 (Unix)

<?php
phpinfo
();
?>
does not list "mod_rewrite" anywhere.
I AM clearing my browser's cache before each attempt.
The .htaccess is being read (IndexIgnore * works).

Thoughts? Thanks in advance.

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

This cheat sheet could help you out.

For your specific question, this should work:

RewriteEngine on

RewriteCond %{HTTP_USER_AGENT}  ^Mozilla.*
RewriteRule  ^$ /index.html  [L]
RewriteRule  ^$ /mobile/index.html  [L]
'

He has: 629 posts

Joined: May 2007

Check the output of your "echo phpinfo()" script once more. If mod-rewrite is installed, it will be listed in the Loaded Modules section of the listing. (The modules are listed alphabetically.) If it's not there, then your host service is misleading you.

Hope this helps.

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

They have: 3 posts

Joined: Jun 2007

pr0gr4mm3r, thanks for responding, but that's exactly the code I've been trying... minus the tabs. I tried it anyway... no go.

webwiz, "mod_rewrite" is nowhere to be found in my phpinfo() script.

So, maybe my question to you gurus should be this: what can I say / what wording can I use, to diplomatically convince my web host technical support folks that a) they are wrong, mod_rewrite ISNT installed, and b) while I may be a server-side scripting rookie, I'm not a complete idiot?

(Or maybe I am? Third opinions?)

Thanks in advance,
Matt

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

majoob;220324 wrote: pr0gr4mm3r, thanks for responding, but that's exactly the code I've been trying... minus the tabs. I tried it anyway... no go.

webwiz, "mod_rewrite" is nowhere to be found in my phpinfo() script.

So, maybe my question to you gurus should be this: what can I say / what wording can I use, to diplomatically convince my web host technical support folks that a) they are wrong, mod_rewrite ISNT installed, and b) while I may be a server-side scripting rookie, I'm not a complete idiot?

(Or maybe I am? Third opinions?)

Thanks in advance,
Matt

mod_rewrite doesn't appear in my phpinfo(). Probably because php on my server is compiled as a CGI module, and not an Apache module. Try some examples from that cheat sheet I posted. If those examples don't work, contact your host with the problem.

...and for the record, the code I posted was different than yours. Yours didn't work on my server until I removed those slashes in the two rules.

They have: 3 posts

Joined: Jun 2007

pr0gr4mm3r, you are correct. I removed the slashes in the two rules and all was well.
Thanks.
Now, leave me alone. I'm busy eating my hat.
(Thanks again) I will read the cheat sheet in detail.

Matt

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.