views:

169

answers:

3

Hello friends...

I have a .htaccess for url rewriting that looks like this:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(.*)\ms.htm $ $manage_student.php [nc]'

The code above gives me an error msg: "Error 500"

I am using apache 5.5.

Can anybody help me with my url rewriting?

A: 

Are you looking for something like this:

How To Succeed With URLs

Anthony
+1  A: 

You get a server error because your rule contains errors

Try this:

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^((.*)/)?ms.htm$ manage_student.php [nc]

The above rule will rewrite ms.htm and any directory conatining ms.htm (like hello/world/ms.htm) to manage_student.php

Explaining what you want the rewrite to do would help us answer your question.

Simon Byholm
A: 
  1. The $ character denotes the end of a regex match. You only need one, and it shouldn't have a space in front of it. That's what's causing the 500 error specifically.

  2. The backslash character is an escape character. If you're trying to make sure it's in a directory, you want a forward slash.

  3. There shouldn't be an apostrophe at the end of the line (though I'm guessing that was a typo).

With those three things applied, your RewriteRule looks like:

RewriteRule ^(.*)/ms.htm$ manage_student.php [NC]
Gabriel Hurley