Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite Error

         

stargoonman

7:36 pm on Oct 3, 2009 (gmt 0)

10+ Year Member



Good day!

I'm trying to put everything that comes after my domain into a variable.
So I would like to work as the following:

[mydomain.com...]

rewrtie into ->

[mydomain.com...]

But my following syntax throws me Internal Server Error 500. It would be appreciated if anyone could help.

Thank you in advance.

.htaccess file content
RewrtieEngine On
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteRule ^(.*) ./index.php?url=$1 [QSA,L]

jdMorgan

8:06 pm on Oct 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What does your server error log say about this?

It is unusual to include "./" in front of the 'target' filepath. Try just "index.php?url=$1" or "/index.php?url=$1"

You may also have to precede your code with


Options +FollowSymLinks

If this option is not already set in the server configuration.

Jim

stargoonman

8:17 pm on Oct 3, 2009 (gmt 0)

10+ Year Member



Hi, thank you for your reply.

It worked with just 'index.php', but it seems variable is not being passed.

If I try to echo $act in index.php, it would show blank.
Do you know why is it doing this?

jdMorgan

8:27 pm on Oct 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Because the "$act" variable isn't being correctly assigned the value from the "url=" name/value pair from STDIN, apparently.

Jim

stargoonman

8:47 pm on Oct 3, 2009 (gmt 0)

10+ Year Member



My bad. :(
But, I don't know where I got $act, but I typed in $url.
So the problem is still alive.

Again, any idea why?

jdMorgan

11:08 pm on Oct 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your form and .htaccess code looks fine. Try using the "Live HTTP Headers" add-on for Firefox/Mozilla and see what the requests sent from the browse to your server look like.

Also, inside your PHP used to process the form, just dump the entire "GET" array to the screen, and see if you see anything strange in there.

If none of that works, change your rule to an external redirect as a temporary test, so that you can see the rewritten path as a URL, and make sure it is right.

Basically, your code is fine. It's trivially simple, and so it's easy to see that as long as the paths are correct, it should work just fine.

Jim

stargoonman

2:38 pm on Oct 4, 2009 (gmt 0)

10+ Year Member



Thank you so much of your support, Jim.
Have a great day. :)