Options +FollowSymLinks
Options +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^haveg/employer/([0-9]+)/(.*) haveg/employer.php?msg_id=$1
It works fine when i use
http://localhost/haveg/employer/7003/the-message-title
or
http://localhost/haveg/employer/7003/
The problem is here http://localhost/haveg/employer/7003
because i removed the forward slash at the end. it gives page not found error.
RewriteRule ^haveg/employer/([0-9]+)/?(.*) haveg/employer.php?msg_id=$1
I think adding a questionmark should allow it to match.
I suggest you add another
RewriteRule
to make your intention clear. In this code the first rule handles the case when the URL ending with digits followed by an optional slash (when themsg_id
query field is blank), and the second applies where there is a message following the digits.Try changing your last line to
This should accept both cases.