Q:

.htaccess rewritebase when in subdirectory on subdomain

As I am trying to transfer my website from localhost to a test domain on our server, I need to adjust my htaccess, since it refers on the localhost to a different folder. I am transfering it to test.mydomain.com/jellyweb/ yet whenever I adjust the rewritebase to match it, the site gives me a 500 error.
    php_flag display_errors on

    Options +FollowSymLinks
    RewriteEngine On

#   RewriteCond %{HTTP_HOST} ^195\.238\.74\.8 
#   RewriteRule (.*) http://www.jellyfishwebdesign.nl/$1 [R=301,L]  
#   RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
#   RewriteRule .* – [F,L]

    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    RewriteBase /test/jellyweb/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([A-Za-z0-9-]+)$ index.php?p=$1 [L]
    RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$  index.php?p=$1&sp=$2 [L]
    RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$  index.php?p=$1&sp=$2&t=$3 [L]

The folder layout is public_html/test/jellyweb
I am not sure how get the rewritebase link correctly in this case, cause even when i just do RewriteBase /jellyweb/ it doesn't work. Am I overseeing something? Sorry, htaccess is not I am familair with really. 
edit
this is the error it pops out.
[Wed Jul 01 16:32:52 2015] [alert] [client 195.240.165.183] /home/jellyf1q/public_html/test/jellyweb/.htaccess: Invalid command '\xef\xbb\xbf', perhaps misspelled or defined by a module not included in the server configuration
hmmm realizing now it may be in the rewriterule of the last line, but not sure what i do wrong.

A:

I solved it, thanks to this post.
500 Internal Server Error when using .htaccess with RewriteEngine
It seemed, since it was saved as UTF8, it added some bytes to it, apache couldn't read. I resaved the file in asci and removed the php command line, resulting it working again. Thanks for the help, @Anubhava

