Jump to content
The Uniform Server Community

RewriteRule makes an 500 Internal Server Error


Stefano
 Share

Recommended Posts

hey @ all =)

its mi first post but untyl today a had no problems with the unifomserver,

nice work =) but there i have one question:

why does a a RewriteRule make an 500 Internal Server Error ?

my code:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([-0-9a-z]*+)/([-0-9a-z]*+)$ /index.php?ids=$1&section=$2
RewriteRule ^([-0-9a-z]*+)/([-0-9a-z]*+)/([-0-9a-z]*+)$ /index.php?ids=$1&section=$2&page=$3
RewriteRule ^([-0-9a-z]*+)/([-0-9a-z]*+)/([-0-9a-z]*+)/([-0-9a-z]*+)$ /index.php?ids=$1&section=$2&page=$3&do=$4

RewriteRule ^contact$ /index.php?ids=contact

it happens also on a fresh uniserver installation as on other OSes to, my OS w2k3, but it also happens on XP.

do someone have some infos how i can realize that the code i posted would work?

an my real webserver it does work, only localy on uniform it wants :D

 

thx

Stefano

Link to comment
Share on other sites

Not sure what you are trying to do with the code however a 500 error indicates a server configuration problem.

 

Check the server error log (*\Uniform Server\udrive\usr\local\apache2\logs\error.log) to see what the problem is.

 

I have little experience with RewriteRule is the first minus valid [-0-9a-z] thought it specified a range hence something should come before it!

 

Are you sure this is a valid construct *+ to me it looks as if they may conflict.

 

You state on your real server it works, would this be Apache 1.3!

 

I think check the error log first, should point you in the right direction. :D

 

All the best

Ric

Link to comment
Share on other sites

Try:

 

RewriteEngine On
RewriteRule ^([-0-9a-z]*+)/([-0-9a-z]*+)$ /index.php?ids=$1&section=$2
RewriteRule ^([-0-9a-z]*+)/([-0-9a-z]*+)/([-0-9a-z]*+)$ /index.php?ids=$1&section=$2&page=$3
RewriteRule ^([-0-9a-z]*+)/([-0-9a-z]*+)/([-0-9a-z]*+)/([-0-9a-z]*+)$ /index.php?ids=$1&section=$2&page=$3&do=$4

RewriteRule ^contact$ /index.php?ids=contact

 

or

 

RewriteEngine On
Options +FollowSymLinks
RewriteRule ^([-0-9a-z]*+)/([-0-9a-z]*+)$ /index.php?ids=$1&section=$2
RewriteRule ^([-0-9a-z]*+)/([-0-9a-z]*+)/([-0-9a-z]*+)$ /index.php?ids=$1&section=$2&page=$3
RewriteRule ^([-0-9a-z]*+)/([-0-9a-z]*+)/([-0-9a-z]*+)/([-0-9a-z]*+)$ /index.php?ids=$1&section=$2&page=$3&do=$4

RewriteRule ^contact$ /index.php?ids=contact

Link to comment
Share on other sites

hey =)

thanks for the replys =)

this is form the error log:

"W:/www/.htaccess: RewriteRule: cannot compile regular expression '^([0-9a-z]*+)/([0-9a-z]*+)$' "

now ive changed this ([-0-9a-z]*+) to this ([0-9a-z])

now there is no error, but i cant use now the function i made before.

this script should work like this:

httq://localhost/main-cat/section1/page2/edit/

and interprets i to:

/index.php?ids=$1&section=$2&page=$3&do=$4

 

i want to eliminate urls like this httq://localhost/?ids=main-category&section=1&do=edit

to make mo user/crawler friendly urls

 

here a Demo

and there is nothing changed its the code ive posted before

hosters apache version is:

Apache/2.0.54 (Debian GNU/Linux) PHP/5.2.4-0+tld0 with Suhosin-Patch mod_ssl/2.0.54 OpenSSL/0.9.7e

 

@olajideolaolorun: ive tried what you have posted but it doesnot work.

 

i am noob in regular expression, so i dont now how to realize this so that it can work localy =(

maybe some idea how to made user friendly urls for the UFS?

 

thx Stefano

 

ps: sorry for my bad english

Link to comment
Share on other sites

I think the only problem is with *+ in the original code use + only try this:

 

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([-0-9a-z]+)/([-0-9a-z]+)$ /index.php?ids=$1&section=$2
RewriteRule ^([-0-9a-z]+)/([-0-9a-z]+)/([-0-9a-z]+)$ /index.php?ids=$1&section=$2&page=$3
RewriteRule ^([-0-9a-z]+)/([-0-9a-z]+)/([-0-9a-z]+)/([-0-9a-z]+)$ /index.php?ids=$1&section=$2&page=$3&do=$4

RewriteRule ^contact$ /index.php?ids=contact

 

All the best

Ric :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...