Only get 500 errors

New to mod_rewrite? This is a good place to start.

Only get 500 errors

Postby colinelligsen » Sun Aug 09, 2009 4:57 am

I have tried various combinations of a test to learn mod_rewrite. Finally, I have tried the most simple .htaccess file I could discover:

RewriteEngine On
RewriteRule goober index.html [NC, R, L]

Not only does this not work (e.g. http://www.allgoodtech.com/goober) but it causes an 500 error for everything including the root (http://www.allgoodtech.com).

I thought this might be a hosting issue, so I called the host who claims that mod rewrite is enabled in the http.conf.

Then I tried exactly the same code above on a different hosting service with exactly the same results.

I would love to use mod_rewrite but can't get even the simplest thing to work!

What am I missing?

Thanks,
Colin Elligsen
colinelligsen
 
Posts: 6
Joined: Sun Aug 09, 2009 4:42 am

Postby richardk » Wed Aug 12, 2009 11:39 am

Try this mod_rewrite test.
What does your error log say?

RewriteEngine On
RewriteRule goober index.html [NC, R, L]

There should not be spaces between RewriteRule flags ([NC, R, L]).
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Thanks now here is what I am trying to do

Postby colinelligsen » Fri Aug 14, 2009 4:16 pm

I would like to turn folders into parameters.

Here is what I've tried.

Options +FollowSymLinks
RewriteEngine On
#Don't match existing files
RewriteCond %{SCRIPT_FILENAME} !-f
#Don't match existing directories
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^/.]+)/?$ ./index.php?page=$1 [L]

When attempting http://www.allgoodtech.com/something I am hoping for http://www.allgoodtech.com/index.php?page=something. However, it just returns the page exactly as if it were not applying a rule.

Any help would be greatly appreciated.

Thanks,
Colin
colinelligsen
 
Posts: 6
Joined: Sun Aug 09, 2009 4:42 am

Oops

Postby colinelligsen » Fri Aug 14, 2009 4:21 pm

It does actually work, I had a domain redirect which apparently is applied first.

Thanks for all your hard work,
Colin
colinelligsen
 
Posts: 6
Joined: Sun Aug 09, 2009 4:42 am

Okay it really doens't work

Postby colinelligsen » Fri Aug 14, 2009 4:25 pm

I had some php code which seemed to do it but the rewrite actually didn't do anything.

Sigh,
Colin
colinelligsen
 
Posts: 6
Joined: Sun Aug 09, 2009 4:42 am

Postby richardk » Sun Aug 16, 2009 6:56 am


Did you try this test? Did it work?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

re: working?

Postby colinelligsen » Sun Aug 16, 2009 3:32 pm

Actually no, now the rewrite does absolutely nothing.

My home page used header location to go to a subdomain which was confusing me. Then I had a missing page which was also redirecting things. Once I turned these both off it didn't seem to work so I tried it on another site with the same results, which is:

The mod rewrite last posted does not generate an error but does nothing.

Sorry for my confusion but I guess if I wasn't confused I wouldn't be asking questions.

So, I am grateful for your input now and the future.

Thank you,
Colin
colinelligsen
 
Posts: 6
Joined: Sun Aug 09, 2009 4:42 am

Test

Postby colinelligsen » Sun Aug 16, 2009 3:35 pm

Oh I didn't notice the test you wrote.

Do I try that on the command line or in .htaccess. I am not sure that I have command line access...

Sorry,
Colin
colinelligsen
 
Posts: 6
Joined: Sun Aug 09, 2009 4:42 am

Postby richardk » Sun Aug 16, 2009 4:59 pm

In a .htaccess file (preferably in your document root).
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Beginner's Corner

Who is online

Users browsing this forum: Google [Bot] and 26 guests

cron