如何修改这个mod重写成我想要的网址?

I actually got an answer that if I want to change my url from www.mydomain.com/laravel4/public/posts into www.mydomain.com/posts

this is what I have to do with my .htaccess

RewriteEngine On

RewriteRule !^laravel4/public/ /laravel4/public%{REQUEST_URI} [L,NC]

but I have another question if I want the url to be www.mydomain.com/laravel4/posts which takes out the public what should I modify? I thought taking out the laravel4 in the code above would work but doesn't seem that easy :(

Ideally you should move the Laravel install out of the document root and just move the contents of the public folder into your document root and edit the index.php and bootstrap/paths.php accordingly, or alternatively set the document root to the public folder of Laravel, some hosts will change the document root for you if you open a support ticket.

However thats not always possible depending on your host, and most people will tell you to go off and find a better host, but again, thats not always an option.

Below is a .htaccess example you can use to rewrite all URLs to the public/index.php of Laravel, but be warned, this isn't a very secure way to setup Laravel, and anyone could potentially access any of your configuration and other files that exist in your document root, exposing your database passwords and secret keys used to encryption.

RewriteEngine On
RewriteRule ^ laravel4/public/index.php [L]

Updated as per request

RewriteEngineOn
RewriteRule ^laravel4/.* laravel4/public/index.php [L]

You can use this rule:

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/laravel4/public(/|$) [NC]
RewriteRule ^laravel4/(.*)$ /laravel4/public/$1 [L,NC]