Forum Moderators: phranque

Message Too Old, No Replies

small .htaccess - Internal Server Error

         

quali74

12:43 pm on Nov 22, 2010 (gmt 0)

10+ Year Member



hi,

I have the following .htaccess


Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?mode=$1


I want to add some code for my 'game' page, it needs to switch to https

The URL, would be as follow www.mydomain.co.uk/game/12345 and I have added this line
RewriteRule ^(.*)game/(.*)$ [mydomain.co.uk...]

when I add this rule, everything stops working and I get "Internal Server Error" in the browser


Usually, my urls are [mydomain.co.uk...] but sometimes I need to pass more variables in the URL. How can I do this?
I tried
RewriteRule ^(.*)/(.*)$ $1/index.php?mode=$1&param1=$2
RewriteRule ^(.*)$ index.php?mode=$1

but again the site stopped working and I get "Internal Server Error" in the browser

It might be the order I add the line the htaccess, I don't know. it's quite confusing to me as I don't know how to debug this kind of file

g1smd

11:14 pm on Nov 22, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Add the [L] flag to every rule. Without it you get an infinite loop.

The [R] flag gives a 302 redirect. Surely you need an internal rewrite?

The (.*) pattern is very inefficient, and needs to be changed.

jdMorgan

9:35 pm on Nov 30, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In both new rules, you need to explicitly exclude the target URL-path or filepath from the RewriteRule pattern. Otherwise, as stated by g1smd, you will get an 'infinite loop.'

Jim